From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

get a menu or submenu ID?

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)

0 Kudos
Message 1 of 5
(1,021 Views)

Hi,

 

I guess GetMenuBarAttribute( MBar, Menu, ATTR_FIRST_ITEM_ID, &MenuItem ); and ...ATTR_NEXT_MENU_ID... would be what you're looking for?

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 2 of 5
(963 Views)

GetPanelMenuBar

int GetPanelMenuBar (int panelHandle);

Purpose

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.

0 Kudos
Message 3 of 5
(939 Views)

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.

0 Kudos
Message 4 of 5
(924 Views)

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).

0 Kudos
Message 5 of 5
(920 Views)