MenuItem and bi-directional realtionship

A menuitem of check_type toggle the visibility of an aui_pan. When closing this pan from close button on it, I would like to update the status of menuitem also. The simple way of doing this is to find out the pan getting closed using “wx.aui.EVT_AUI_PANE_CLOSE” and change the status of menuitem realted to it.
In my case the entire menu items are generated from an xml file thus items are not stored separately into variables.

Logically If I could give a string name to menuitem, say “pan01” and get this item object using it’s name in “wx.aui.EVT_AUI_PANE_CLOSE” procedure then things would be much easier.
Is it possible? or any workaround?

Prashant

···

Add more friends to your messenger and enjoy! Invite them now.

Prashant Saxena wrote:

A menuitem of check_type toggle the visibility of an aui_pan. When closing this pan from close button on it, I would like to update the status of menuitem also. The simple way of doing this is to find out the pan getting closed using "wx.aui.EVT_AUI_PANE_CLOSE" and change the status of menuitem realted to it.
In my case the entire menu items are generated from an xml file thus items are not stored separately into variables.

Logically If I could give a string name to menuitem, say "pan01" and get this item object using it's name in "wx.aui.EVT_AUI_PANE_CLOSE" procedure then things would be much easier.
Is it possible? or any workaround?

You can use the XRC ID of the menu item (a string) to get the item's ID using XRCID(name) and then from that you can find the wx.MenuItem via the frame's menubar.

Or you can use EVT_UPDATE_UI events as described here a couple days ago to deal with updating the menu item states based on flags or the states of other objects in your application.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!