Description
Determines the total number of items in a ribbon menu.
Applies to
RibbonMenu controls
Syntax
controlname.GetItemCount ( { Long ParentIndex } )
Argument |
Description |
---|---|
controlname |
The name of the RibbonMenu control |
ParentIndex |
The index of the menu item (RibbonMenuItem) whose submenu items you want to count. If not specified, the menu item will be counted; if specified to a valid value, the submenu items of the 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 menu. If the menu contains no items, returns 0. If an error occurs, returns -1. If any argument's value is null, returns null.
Usage
A RibbonMenu control can contain menu items in no more than two levels.
Examples
This example counts the menu item (which returns 1) and its submenu items (which returns 2).
Long ll_Index, ll_Index2, ll_Count RibbonMenu lr_Menu ll_Index = lr_Menu.InsertItemLast ("MenuItem1", "AddSmall!", "Ue_MenuItem1Clicked") ll_Index2 = lr_Menu.InsertItemLast (ll_Index, "SubMenuItem1", "AddSmall!", "Ue_MenuItem11Clicked") ll_Index2 = lr_Menu.InsertItemLast (ll_Index, "SubMenuItem2", "AddSmall!", "Ue_MenuItem12Clicked") ll_Count = lr_Menu.GetItemCount (ll_Index) ll_Count = lr_Menu.GetItemCount ()
See also