Description
Determines the total number of the master menu items in the application menu.
Applies to
RibbonApplicationMenu controls
Syntax
controlname.GetMasterItemCount ( { Long ParentIndex } )
Argument |
Description |
---|---|
controlname |
The name of the RibbonApplicationMenu control |
ParentIndex (optional) |
The index of the master menu item (RibbonMenuItem) whose submenu items you want to count. If not specified, the master menu items will be counted; if specified to a valid value, the submenu items under the master menu item (whose index is ParentIndex) will be counted; if specified to an invalid value, an error would occur and this operation would return -1. |
Return value
Long.
Returns the total number of menu items in the master menu. If the master menu contains no items, returns 0. If an error occurs, returns -1. If any argument's value is null, returns null.
Usage
The master menu can have no more than two levels.
Examples
This example inserts an "Account" master menu and then inserts two submenu items "Account Settings" and "Sign Out" under "Account", and then counts the number of the submenu items (which returns 2) and the master menu item (which returns 1).
Long ll_Index, ll_Index2, ll_Count RibbonApplicationMenu lr_AppMenu ll_Index = lr_AppMenu.InsertMasterItemLast ("Account", "AccountBig!", "Ue_AccountMenuItemClicked") ll_Index2 = lr_AppMenu.InsertMasterItemLast (ll_Index, "Account Settings", "AccountSettingsBig!", "Ue_AccountSettingsBigClicked") ll_Index2 = lr_AppMenu.InsertMasterItemLast (ll_Index, "Sign Out", "SignOutBig!", "Ue_SignOutClicked") ll_Count = lr_AppMenu.GetMasterItemCount (ll_Index) ll_Count = lr_AppMenu.GetMasterItemCount()
See also