Eg if ($event->GetEventType == wxEVT_COMMAND_BUTTON_CLICKED) {
Do some stuff.
}
_____
From: Helen Craigman [mailto:[email protected]]
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@[email protected]/113/wx.PyComma
ndEvent)
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.