Syntax 4: For RibbonMenu controls
Description
Sets a menu item for a ribbon menu.
Applies to
Syntax
|
1 |
controlname.SetItem ( { Long ParentIndex, } Long Index, RibbonMenuItem Item ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the RibbonMenu control in which you want to |
|
ParentIndex |
The index of the menu item (RibbonMenuItem) whose If not specified, the menu item will be set; if |
|
Index |
The index of the menu item or submenu item for which you |
|
Item |
A RibbonMenuItem item you want to set. Only |
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 menu items with the “Normal” or “Separator” type (that is
RibbonMenuItem with ItemType 0 or 1) can be added to the RibbonMenu
control.
A RibbonMenu control can contain menu items in no more than two
levels.
The user events to be bound with the 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” menu and the “SubMenuItem”
submenu and then sets values for their properties (including Text,
PictureName, and 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 RibbonMenu lr_Menu RibbonMenuItem lr_MenuItem1, lr_MenuItem2 ll_Index = lr_Menu.InsertItemLast ("MenuItem", "AddSmall!", "Ue_MenuItem1Clicked") ll_Index2 = lr_Menu.InsertItemLast (ll_Index, "SubMenuItem", "AddSmall!", "Ue_MenuItem11Clicked") lr_MenuItem1.Text = "MenuItem1" lr_MenuItem1.PictureName = "DeleteSmall!" lr_MenuItem1.Clicked = "Ue_MenuItem2Clicked" lr_MenuItem2.Text = "SubMenuItem1" lr_MenuItem2.PictureName = "DeleteSmall!" lr_MenuItem2.Clicked = "Ue_MenuItem21Clicked" li_Return = lr_Menu.SetItem (ll_Index, lr_MenuItem1) li_Return = lr_Menu.SetItem (ll_Index, ll_Index2, lr_MenuItem2) |
See also