Is it possible to send a menu event to a panel in the frame?
My app is using a notebook, and I'm developing each panel in
individual files. Each panel also has a menu that gets swapped out
depending on which panel is selected. (I suppose I could just as
easily enable/disable them.) Since the Menu is attached to the Frame,
can I have the Panel check for handlers?
I'm afraid event propagation and management is still a bit beyond my
understanding.
Is it possible to send a menu event to a panel in the frame?
My app is using a notebook, and I'm developing each panel in
individual files. Each panel also has a menu that gets swapped out
depending on which panel is selected. (I suppose I could just as
easily enable/disable them.) Since the Menu is attached to the Frame,
can I have the Panel check for handlers?
I'm afraid event propagation and management is still a bit beyond my
understanding.
The menu event will be delivered to the frame, so you need to bind a handler there. However you can easily catch the event there and then resend it to the panel, just use something like thePanel.GetEventHandler().ProcessEvent(theEvent). Be careful though, because if the event is not handled in the panel then it will propagate to the frame again and you'll get stuck in an endless loop and the universe will get sucked down the rabbit hole. On the other hand, since you need to catch the event by binding to the frame anyway, you can just as easily call some method in the panel directly, or send a message with pubsub, or...
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!