Thread: resetMenuItems() not working?
-
March 29th, 2022, 16:18 #1
resetMenuItems() not working?
I have a nested (item in a list) windowclass that wants to redefine the set of radial menu items defined by a containing windowclass (window containing the list). I have tried adding resetMenuItems() to this windowclass's onInit() prior to registering new menu items, but I'm still seeing the menu items defined by the containing windowclass.
Note that I am able to modify existing menu items, but what I really want is to have superfluous menu items removed. This is what I was hoping resetMenuItems() would do. But I'm guessing that resetMenuItems() only applies to menu items added by the same windowclass?
Is there a way to get around this menu layering behavior?
EDIT: Seems like an "unregisterMenuItem(nPos)" API might be useful?Last edited by darrenan; March 29th, 2022 at 16:36.
-
March 29th, 2022, 19:08 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,581
Yes, custom menu items must be reset/added in the exact same window class. There's no way to cross window/control boundaries for custom menu item access; so no valid place to have an unregister option since the menus are built in layered order (both native and custom).
Regards,
JPG
-
March 29th, 2022, 21:44 #3
Hmm, so the only solution then is to push all menu item registration down to the lowest possible level and possibly have duplications across windowclasses/controls?
-
March 29th, 2022, 22:00 #4
The documentation for onMenuSelection doesn't mention a return value, does this mean that it does not chain up like some of the other handlers do? For instance, can a contained windowclass handle a subset of the menu items and pass any other up to the containing window's handler?
EDIT: Or does the window that defines the menu item automatically only get those selections?
EDIT2: Confirmed via experimentation. If two nested windowclasses define the same menu item, they each get their own onMenuSelection handler called for those items.Last edited by darrenan; March 29th, 2022 at 22:59.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks