SetRecentItem

Description

Sets a recent menu item for the application menu in the RibbonBar control.

Applies to

RibbonApplicationMenu controls

Syntax

controlname.SetRecentItem ( Long Index, RibbonMenuItem Item )

Argument

Description

controlname

The name of the RibbonApplicationMenu control in which you want to set the recent menu item.

Index

The index of the recent menu item for which you want to set. If index is invalid, an error would occur and this operation would return -1.

Item

A RibbonMenuItem item you want to set. Only RibbonMenuItem with "Recent(2)" ItemType is supported. If RibbonMenuItem is with other ItemType such as "Normal(0)" or "Separator(1)", an error would occur and this operation would return -1.


Return value

Integer.

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

Usage

Only the menu item with the "Recent" type (that is RibbonMenuItem with ItemType 2) can be added as a recent menu item.

The recent menu can have only one level; and can contain no more than 9 items.

The user events to be bound with the recent menu item must be defined correctly according to the requirements of RibbonMenuItem. For details, see Clicked and Selected.

Examples

This example inserts the "RecentItem1" recent menu item and binds it with the "Ue_RecentItem1Clicked" user event, and then changes the text of this item to "RecentItem2" and the bound user event to "Ue_RecentItem2Clicked".

Integer li_Return
Long ll_Index
RibbonApplicationMenu lr_AppMenu
RibbonMenuItem lr_MenuItem

ll_Index = lr_AppMenu.InsertRecentItemFirst("RecentItem1", "Ue_RecentItem1Clicked")
lr_MenuItem.ItemType = 2
lr_MenuItem.Text = "RecentItem2"
lr_MenuItem.Clicked = "Ue_RecentItem2Clicked"
li_Return = lr_AppMenu.SetRecentItem(ll_Index, lr_MenuItem)

See also

AddMasterSeparatorItem

ClearRecentItems

DeleteMasterItem

DeleteRecentItem

GetMasterItem

GetMasterItemCount

GetRecentItem

GetRecentItemCount

GetRecentTitle

InsertMasterItem

InsertMasterItemFirst

InsertMasterItemLast

InsertRecentItem

InsertRecentItemFirst

InsertRecentItemLast

SetMasterItem

SetRecentTitle