05-06-2010 04:39 PM
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
05-06-2010 05:06 PM
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.