Help - Search - Members - Calendar
Full Version: Main menu in a UI
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
hunted
I'm a little confused how I should be using menu_manager for a main menu in a UI.
I'm wondering if I should be using static void menu_manager::win32_build_menu(HMENU menu,menu_node * parent,int base_id,int max_id); but that creates a popup menu, I'm not sure what I should do with that or when I would call it.
I got it to work by just calling win32_build_menu() and calling SetMenu() with the resulting HMENU. If thats a good way, is it a bad idea to just call menu_manager::create() on init, and service_release() it on shutdown?
If I don't do that, is there a chance the menu_node ids will change if I release it before I get a WM_COMMAND, it says releasing the menu_manager releases nodes, so I'm guessing it's possible?
foosion
QUOTE(hunted @ Sep 19 2005, 09:16 PM)
If I don't do that, is there a chance the menu_node ids will change if I release it before I get a WM_COMMAND, it says releasing the menu_manager releases nodes, so I'm guessing it's possible?
*

No, once initialized the IDs will stay the same, and the menu nodes will not reflect any changes made to the menu after initialisation of the menu_manager instance that owns them, whether this changes are made by the user (rearranging the menu) or by the program (greying out commands, toggling checkmarks). In short it is a bad idea to use a single menu_manager instance and initialize it once.

The preferred way is to refresh the contents of the submenus when they are opened (detectable through WM_INITMENUPOPUP).
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.