Is it possible to hide a specific menuitem from a drop down menu. I do want to use menuitem.Enable(0) as it will still show menuitem in drop down menu.
I need this to implement a requirement in which menuitems should load according to user permisions. So if a user has read permissins she should only see items which allow user to view data. If user has write permissions then user should see items associated view viewing as well as writing data.
can anyone suggest an alternative method other than hidding menuitems i.e is there a way to load menuitems from a xrc file based on some kind of rule set.
If the user is authenticated before the form is loaded, then just use some
if-then expressions to decide whether the given menu items should be added
to the menu bar. I don't know if that's optimal or not, but I believe it is
the way I would approach the problem.
Is it possible to hide a specific menuitem from a drop down menu. I do
want to use menuitem.Enable(0) as it will still show menuitem in drop
down menu.
I need this to implement a requirement in which menuitems should load
according to user permisions. So if a user has read permissins she
should only see items which allow user to view data. If user has write
permissions then user should see items associated view viewing as well
as writing data.
can anyone suggest an alternative method other than hidding menuitems
i.e is there a way to load menuitems from a xrc file based on some kind
of rule set.
If the user is authenticated before the form is loaded, then just use some
if-then expressions to decide whether the given menu items should be added
to the menu bar. I don't know if that's optimal or not, but I believe it is
the way I would approach the problem.
infact i also want to approach teh problem same way. But since gui is defned using xrc there is a limitation. I am using LoadMenuBar() to load gui from xrc file and LoadMenuBar() loads all menuitems once.
Is it possible to use xrc to define menu but still load menuitem one by one using if-then statements ?
If the user is authenticated before the form is loaded, then just use some
if-then expressions to decide whether the given menu items should be added
to the menu bar. I don't know if that's optimal or not, but I believe it is
the way I would approach the problem.
infact i also want to approach teh problem same way. But since gui is defned using xrc there is a limitation. I am using LoadMenuBar() to load gui from xrc file and LoadMenuBar() loads all menuitems once.
Is it possible to use xrc to define menu but still load menuitem one by one using if-then statements ?
No, but you can easily remove items.
item = menubar.FindItem(XRCID("SomeAdminThing"))
menu = item.GetMenu()
menu.RemoveItem(item)
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!