hello,
probably this migth be a weird question from a programmers point of view,
but for me as a simple user I can't think of a better way.
I'm trying to make some convenient popup menu procedures,
and now I have something that works,
but I don't know if it's technically allowed.
This is what my derived component looks like,
the OnSelect is catched before the user can get hold of it.
class My_Popup_Menu ( wx.Menu ) :
def __init__ ( self, OnSelect, items = None ):
wx.Menu.__init__ ( self )
... create the menu while saving the menu-IDs
def OnSelect ( self, event ) :
ID_sel = event.GetId ()
for i, ID in enumerate ( self.IDs ) :
if ID == ID_sel :
break
# return the list-index through "event.Int"
event.Int = i
event.Skip ()
The trick is to give the user an index of the (real) item in the popup-list,
which is now passed by the event property "Int" .
I don't know what "Int" is used for, but it always seems to be zero,
so it seemed valid for me to use it for a better task
Although it seems to work perfectly,
Is this allowed ?
thanks,
Stef Mientki