another menu question

BlitzMax Forums/Brucey's Modules/another menu question

GaNDaLDF(Posted 2009) [#1]
I get another problem that is drive me crazy.. I've tried to understand your menu example but I can't see where you disable the submenu.. I use this code:

Function OnUpdateMenu(event:wxEvent)
wxUpdateUIEvent(event).Enable(False)
End Function

I pass it the event id.. it works with normal item but not works with submenu??
WHY???? :(


Brucey(Posted 2009) [#2]
In the example, if you are running on Mac, you'll probably be able to see the results better if you change a line in the GetLastMenuItem() method (about line 731) :
		Local menu:wxMenu = menubar.GetMenu(menubar.GetMenuCount() - 2)

instead of "-1".

The Mac has the Help menu as the last menu in the toolbar, and trying to disable the Search submenu option probably isn't going to result in anything useful.

However, when changed to -2, it should disable the bottom sub-menu in the "Test" menu.

If you can't see that working, then I'm not sure what would be your problem.


GaNDaLDF(Posted 2009) [#3]
mm I don't think to have understand, because my problem isn't with the help menu..
I just need to disable (or turn to gray) a submenu in my menu bar like you have done in your example with the "Standard Item Demo" submenu.. when I run the demo in fact under the File menu there's this submenu disabled.. and I would do the same thing on mine. I have tried to disable it with the code:

wxUpdateUIEvent(event).Enable(False)

but it seems this code works only with normal items of the menu not with the submenu.


Brucey(Posted 2009) [#4]
Well, if you have a reference to the menuItem, you can call menuItem.Enable(false)

Using the menuBar reference, you can also find a menu item using FindItem(id:int).