Monday, March 7, 2011

Change the Attribute of a Menu Bar Item from Within the Code

Suppose we have a simple menu bar (with a Menu Bar Constant Prefix of "MENUBAR") with one item (Constant Name of "ITEM1"), the item is initially dimmed and we want to change this somewhere within the code, to do so we need to do the following :
  • Define a new variable to represent the menu bar:
        int menuHandle.
  • Assign the new variable a value representing the panel's menu bar:
        menuHandle = GetPanelMenuBar (panelHandle);
  • Change the attribute you want, in our case it will lok like this:
        SetMenuBarAttribute (menuHandle, MENUBAR_ITEM1, ATTR_DIMMED, 0);

    No comments:

    Post a Comment