Sets the text of the specified menu item.
GSErrCode ACAPI_Interface ( APIIo_SetMenuItemTextID, const API_MenuItemRef* menuItemRef, char* itemText, GS::UniString* itemUniText );
Parameters
- menuItemRef
- [in] Identifies the menu item.
- itemText
- [in] Menu item text to set (if you don’t pass itemUniText).
- itemUniText
- [in] Optional Unicode menu item text to set.
Return Values
NoError
- The function has completed with success.
APIERR_BADPARS
- menuItemRef or both itemText and itemUniText 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 text 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 text of a menu item use the APIIo_GetMenuItemTextID function.
Example
void SetPaletteMenuText (short paletteItemInd, bool paletteIsVisible) { API_MenuItemRef itemRef; GS::UniString itemStr; if (paletteIsVisible) itemStr.Append ("Hide Palette"); else itemStr.Append ("Show Palette"); BNZeroMemory (&itemRef, sizeof (API_MenuItemRef)); itemRef.menuResID = 32500; itemRef.itemIndex = paletteItemInd; ACAPI_Interface (APIIo_SetMenuItemTextID, &itemRef, nullptr, itemStr); return; }
Requirements
- Version: API 2.1 or later
- Header: APIdefs_Interface.h
See Also
API_MenuItemRef,
APIIo_GetMenuItemTextID,
ACAPI_Interface, API Functions