LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetCtrlMenuAttribute Control ID? built into uir

This i assume is very easy but I cannot figure what the heck integer value goes into the field for Control ID

 

I'm trying to determine if a menu item is checked in its callback function.

 

GetCtrlMenuAttribute (panelHandle,??? what goes here?,menuItem, ATTR_CHECKED, &checked);

 

I feel like I have tried everything.  I designed the menu by going into Create > MenuBar.  Then I select that menubar in my panels 'Edit Options' Window.  I even get the id of it on load as follows in my main function:  errChk( propMenuBar = GetPanelMenuBar (panelHandle));

 

But can't figure out the argument for Control ID.  Below are some variables autogenerated in my header file.  I feel like I've tried every combination though.

 

Header file contents:

     /* Menu Bars, Menus, and Menu Items: */

#define  MENUBAR                          1
#define  MENUBAR_VIEW                     2
#define  MENUBAR_VIEW_VIEW_AVERAGE        3       /* callback function: VIEW_AVERAGE */
#define  MENUBAR_VIEW_VIEW_INPUT          4       /* callback function: VIEW_INPUT */
#define  MENUBAR_VIEW_VIEW_OUTPUT         5       /* callback function: VIEW_OUTPUT */

 

 

Thanks

0 Kudos
Message 1 of 2
(2,978 Views)

GetCtrlMenuAttribute is intended to handle menus owned by some particular control (as an example, tables are controls that can own a menu): in this case, in 'control' field the control ID for the table or other control must be put.

 

To get attributes for menus owned by panels you must use GetMenuBarAttribute, either in the way

   GetMenuBarAttribute (menuHandle,  MENUBAR_VIEW_VIEW_AVERAGE, ATTR_CHECKED, &checked);

or in the way

   GetMenuBarAttribute (GetPanelMenuBar (panelHandle),  MENUBAR_VIEW_VIEW_AVERAGE, ATTR_CHECKED, &checked);

depending on whether you already know the menu bar handle or not.



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 2
(2,974 Views)