AddSeparatorItem

Description

Adds a menu separator to the ribbon menu.

Applies to

RibbonMenu control

Syntax

controlname.AddSeparatorItem ({ Long ParentIndex })

Argument

Description

controlname

The name of the RibbonMenu control into which you want to insert a menu separator.

ParentIndex

The index of the menu item (RibbonMenuItem) into which you want to insert a submenu separator.

It cannot be an index of a separator. If not specified, a separator will be added at the end of the menu; if specified to a valid value, a separator will be added at the end of the submenu under the menu item (whose index is ParentIndex); if specified to an invalid value, an error would occur and this operation would return -1.


Return value

Long.

Returns the position of the new item if it succeeds and -1 if an error occurs. If any argument's value is null, returns null.

Usage

The menu separator is a horizontal line used to visually distinguish between groups of menu items. The separator can only be added in the master menu of RibbonApplicationMenu (AddMasterSeparatorItem) or in the menu of RibbonMenu (AddSeparatorItem); it cannot be added to the recent menu of RibbonApplicationMenu.

Examples

This example inserts a menu separator below the "MenuItem1" menu item and inserts another menu separator in the submenu of "MenuItem1".

Long ll_Return,ll_Index
RibbonMenu lr_Menu

ll_Return = lr_Menu.AddSeparatorItem()
ll_Index = lr_Menu.InsertItemFirst ("MenuItem1", "AddSmall!", "Ue_MenuItemClicked")
ll_Return = lr_Menu.AddSeparatorItem (ll_Index)

See also

DeleteItem

GetItem

GetItemCount

InsertItem

InsertItemFirst

InsertItemLast

SetItem