LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about using menu bar attributes

I created a menu bar that I'm using in several Panels. To create the menu bar handle I use the main panel of my application:

if ((OdinMenuHandle = LoadMenuBar (MainPanelHandle, "WXGA120.uir", ODINMENU)) < 0)
return -1;

Now I want to use the ATTR_CHECKED attribute for a menu item. See the code below:

void CVICALLBACK DisableStoringCallback (int menuBar, int menuItem, void *callbackData, int panel){
// Disable (or enable) storing data in the flash memory.
if (disable_storing == FALSE){
SetMenuBarAttribute (OdinMenuHandle, ODINMENU_OPTIONS_DISABLE_STORING, ATTR_CHECKED, TRUE);
disable_storing = TRUE;
}
else{
SetMenuBarAttribute (OdinMenuHandle, ODINMENU_OPTIONS_DISABLE_STORING, ATTR_CHECKED, FALSE);
disable_storing = FALSE;
}
}

This works fine when the main panel of my application is the active panel. But if another panel (also using this menu) is active, the disable_storing variable is changed, but the menu item is not checked. You can only see that it is checked if the main panel is active.
How can I let the user see that the item is checked if another panel than the main panel is active?
0 Kudos
Message 1 of 3
(3,139 Views)
Menu bars are not unique throughout the project: each panel holds its own menu bar that is different from the one on another panel and can hold different attributes.

To do what you want, you'll have to run through all the panels into which the menu bar is loaded and explicitly update the panel menu bar.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,136 Views)
Thanks a lot. It works great now.
0 Kudos
Message 3 of 3
(3,130 Views)