SetMasterItem
PowerScript function
Description
Sets a master menu item for the application menu in the RibbonBar
control.
Applies to
Syntax
|
1 |
controlname.SetMasterItem ( { Long ParentIndex, } Long Index, RibbonMenuItem Item ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the RibbonApplicationMenu control in which you |
|
ParentIndex (optional) |
The index of the master menu item (RibbonMenuItem) whose If not specified, the master menu item will be set; if |
|
Index |
The index for the master menu item or submenu item for |
|
Item |
A RibbonMenuItem item you want to set. Only RibbonMenuItem |
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 “Normal” or “Separator” type (that is
RibbonMenuItem with ItemType 0 or 1) can be added as a master menu
item.
The master menu can have no more than two levels.
The user events to be bound with the master menu item must be
defined correctly according to the requirements of RibbonMenuItem. For
details, see Clicked in PowerScript Reference and Selected in PowerScript Reference.
Examples
This example inserts the “MenuItem” master menu item and the
“SubMenuItem” submenu item and then sets values for their properties
(including Text, PictureName, Clicked etc.).
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Integer li_Return Long ll_Index,ll_Index2 RibbonApplicationMenu lr_AppMenu RibbonMenuItem lr_MenuItem1,lr_MenuItem2 ll_Index = lr_AppMenu.InsertMasterItemLast("MenuItem","AddSmall!","Ue_MenuItem1Clicked") ll_Index2 = lr_AppMenu.InsertMasterItemLast(ll_Index,"SubMenuItem","AddSmall!","Ue_MenuItem11Clicked") lr_MenuItem1.Text = "Account" lr_MenuItem1.PictureName = "AccountBig!" lr_MenuItem1.Clicked = "Ue_AccountMenuItemClicked" lr_MenuItem2.Text = "Account Settings" lr_MenuItem2.PictureName = "AccountSettingsBig!" lr_MenuItem2.Clicked = "Ue_AccountSettingsClicked" li_Return = lr_AppMenu.SetMasterItem(ll_Index,lr_MenuItem1) li_Return = lr_AppMenu.SetMasterItem(ll_Index,ll_Index2,lr_MenuItem2) |
See also