APIIo_​SetMenuItemFlagsID

Sets the flag values of the specified menu item.

    GSErrCode ACAPI_Interface (
        APIIo_SetMenuItemFlagsID,
        const API_MenuItemRef*     menuItemRef,
        GSFlags                    itemFlags
    );

 

Parameters

menuItemRef
[in] Identifies the menu item.
itemFlags
[in] Menu item flags.

Flag Value

Meaning

API_MenuItemDisabled

Disable the menu item

API_MenuItemChecked

Check the menu item

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
any of the parameters are nullptr
APIERR_BADINDEX
the specified menu item does not belong to the caller add-on

For other common API errors see the API Errors document.

 

Remarks

This function is used to set the current status of a menu item which belongs to the caller API tool add-on. The menu item is referenced with the resource ID and the string number.

To get the current status of a menu item use the APIIo_GetMenuItemFlagsID function.

Note that the initial status of a menu item can also be set in the menu item string resources of the add-on. Refer to the STR# specification explained in the Required Resources paper in details.

 

Example


// -----------------------------------------------------------------------------
// Checkmark a menu item of the addon
// -----------------------------------------------------------------------------

static void             CheckACMenuItem (short itemInd, bool checked)
{
        API_MenuItemRef itemRef;
        GSFlags         itemFlags;

        BNZeroMemory (&itemRef, sizeof (API_MenuItemRef));
        itemRef.menuResID = 32500;
        itemRef.itemIndex = itemInd;

        itemFlags = 0;
        ACAPI_Interface (APIIo_GetMenuItemFlagsID, &itemRef, &itemFlags);
        if (checked)
                itemFlags |= API_MenuItemChecked;
        else
                itemFlags &= ~API_MenuItemChecked;
        ACAPI_Interface (APIIo_SetMenuItemFlagsID, &itemRef, &itemFlags);

        return;
}               // CheckACMenuItem

 

Requirements

Version: API 2.1 or later
Header: APIdefs_Interface.h

 

See Also

API_MenuItemRef,
APIIo_GetMenuItemFlagsID,
ACAPI_Interface, API Functions