In wxPerl, many cases, this doesn't work, since (in those cases) the constant wxEVT_SOMETHING is not exported for event EVT_SOMETHING.
An "EVT_SOMETHING.typeId" functionality (or EVT_SOMETHING->typeId(), or EVT_SOMETHING->{typeId} ), enables you to obtain the event type even when wxEVT_SOMETHING is not exported. ----- Original Message ----- From: steveco.1...@gmail.com To: 'Helen Craigman' ; 'wxperl-users' Sent: Sunday, 26 May, 2013 0:54 Subject: RE: How to find the event type in wxPerl? Eg if ($event->GetEventType == wxEVT_COMMAND_BUTTON_CLICKED) { Do some stuff. } ------------------------------------------------------------------------------ From: Helen Craigman Sent: 25 May 2013 17:55 To: wxperl-users Subject: How to find the event type in wxPerl? Dear wxPerl experts In wxPython, you can find an event type by calling a method (or property?) "typeId". See examples below. It seems that there is no such functionality in wxPerl (maybe since "EVT_SOMETHING" in wxPerl encapsulates the call to the event binder, while in wxPython, "EVT_SOMETHING" is a lower-level subroutine?) Finding the event type enables you to mimic (or artificially trigger) a widget command event. This is sometimes necessary, for testing purposes and other programmatic purposes. (It's necessary in order to mimic existing events, not only for custom, user-defined events). Is there a way to get the EVT_SOMETHING.typeId functionality in wxPerl? Many TIA Helen -------------------------------- Examples: 1. > event = wx.CommandEvent(self.EVT_TEXT_CHANGED.typeId, self.Id) (in: https://svn.ceon.pl/research/SegmEdit/SegmEditGUI/controls.py) 2. > printevent = wx.PyCommandEvent(EVT_PRINT_MESSAGE.typeId, ID_PRINT_MESSAGE) (line 113 in: http://nullege.com/codes/show/src@p@y@python-irc-h...@pyrc.py/113/wx.PyCommandEvent) 3. > if evt and (renewOverlay or evt.GetEventType() == wx.EVT_SIZE.typeId): (line 150 in: www.seismic-handler.org/browser/SHX/trunk/sandbox/traceplotter.py?rev=414) and many others.