InsertMasterItemFirst
PowerScript function
Description
Inserts a master menu item as the first item in the application
menu.
Applies to
Syntax
|
1 |
controlname.InsertMasterItemFirst ( { Long ParentIndex, } String Text, String PictureName, String Clicked ) |
|
1 |
controlname.InsertMasterItemFirst ( { Long ParentIndex, } RibbonMenuItem Item ) |
|
Argument |
Description |
|---|---|
|
controlname |
The RibbonApplicationMenu control in which you want to |
|
ParentIndex |
The index of the master menu item (RibbonMenuItem) into It cannot be an index of a separator (that is |
|
Text |
The text that displays in the master menu item or submenu |
|
PictureName |
The name of the file that contains the picture. The image |
|
Clicked |
The name of the Clicked user event to be bound with the |
|
Item |
A RibbonMenuItem item you want to insert. Only |
Return value
Long.
Returns the position of the item 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.
Example 1
This example inserts a master menu item “Account” as the first item
and a submenu item “Account Settings” as the first item under “Account”
and binds the master menu item with the “Ue_AccountMasterItemClicked” user
event and the submenu item with the “Ue_AccountSettingsClicked” user
event.
|
1 2 3 4 5 |
Long ll_Return, ll_Index RibbonApplicationMenu lr_AppMenu ll_Index = lr_AppMenu.InsertMasterItemFirst ("Account", "AccountBig!", "Ue_AccountMasterItemClicked") ll_Return = lr_AppMenu.InsertMasterItemFirst (ll_Index, "Account Settings", "AccountSettingsBig!", "Ue_AccountSettingsClicked") |
Example 2
This example defines three RibbonMenuItem items (lr_MenuItem1,
lr_SubMenuItem1, lr_MenuSeparator1) with various properties
(lr_MenuSeparator1 is set to item type 1, which means it will be displayed
as a separator line; lr_MenuItem1 is set to bind with the
“Ue_AccountMasterItemClicked” user event; lr_SubMenuItem1 is set to bind
with the “Ue_SignOutMenuItemClicked” user event), and then inserts
lr_MenuItem1 as a master menu item as the first item, lr_SubMenuItem1 as a
submenu item as the first item, and lr_MenuSeparator1 as a separator line
displayed above the new submenu item.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Long ll_Return, ll_Index RibbonApplicationMenu lr_AppMenu RibbonMenuItem lr_MenuItem1, lr_SubMenuItem1, lr_MenuSeparator1 lr_MenuItem1.Text = "Account" lr_MenuItem1.PictureName = "AccountBig!" lr_MenuItem1.Clicked = "Ue_AccountMasterItemClicked" lr_SubMenuItem1.Text = "Sign Out" lr_SubMenuItem1.PictureName = "SignOutBig!" lr_SubMenuItem1.Clicked = "Ue_SignOutMenuItemClicked" lr_MenuSeparator1.ItemType = 1 ll_Index = lr_AppMenu.InsertMasterItemFirst (lr_MenuItem1) ll_Return = lr_AppMenu.InsertMasterItemFirst (ll_Index, lr_SubMenuItem1) ll_Return = lr_AppMenu.InsertMasterItemFirst (ll_Index, lr_MenuSeparator1) |
See also