02-26-2022 12:19 PM
Hey there, I am making a generalized utility function to check/uncheck a menuitem inside a menu in a menubar. This would be handy when I'm treating a menu like a ring control, where only one of the menuitems can be checked at a time.
Is there not a way of programmatically deriving the menu/submenu ID? I don't see one. There's an attribute for menu name.
For my utility to iterate through all discovered menuitems of a menu, I need the menu ID. It would be nice for the caller to not have to pass that to this function. If I have a callback attached to the menuitem already, the only known parameters when that callback fires is of course:
menucallback (int menuBar, int menuItem, void *callbackData, int panel)
02-28-2022 02:51 AM
Hi,
I guess GetMenuBarAttribute( MBar, Menu, ATTR_FIRST_ITEM_ID, &MenuItem ); and ...ATTR_NEXT_MENU_ID... would be what you're looking for?
02-28-2022 04:20 PM
int GetPanelMenuBar (int panelHandle);
Returns the handle of the menu bar associated with a specific panel.
If there is no menu associated with the panel, this function returns zero.
03-03-2022 03:56 PM
This function only returns the menubar, not the menu/submenu. I'm currently making a utility function to do what I'm after. I'll post here later.
03-03-2022 04:36 PM
Ok, here is a project with my functions to retrieve a menu or submenu ID (GetItemMenuID), set exclusively a single menu/submenu item (SetExclusiveMenuCheckbox) and retrieve the singly set menu/submenu item (GetExclusiveMenuCheckbox).