Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Syntax 7: For RibbonMenu controls – PB Docs 2021 – PowerBuilder Library

Syntax 7: For RibbonMenu controls – PB Docs 2021

Syntax 7: For RibbonMenu controls

Description

Inserts a menu item at the specified position in a ribbon
menu.

Applies to

RibbonMenu
control

Syntax

Argument

Description

controlname

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

ParentIndex

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

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

Index

The index number of the menu item or submenu item before
which you are inserting a new menu item. If index is invalid,
an error would occur and this operation would return
-1.

Text

The text that displays in the menu item or submenu
item.

PictureName

The name of the file that contains the picture. The
image is displayed in 16*16 pixels.

Clicked

The name of the Clicked user event to be bound with the
menu item. The Clicked user event for the menu item must be
defined with the required parameters and types. For details,
see Clicked in PowerScript Reference.

Item

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

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 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.

Example 1

This example inserts a “MenuItem1” menu item and then inserts two
submenu items “SubMenuItem1” and “SubMenuItem2” under
“MenuItem1”.

Example 2

This example also inserts a “MenuItem1” menu item and then inserts
two submenu items “SubMenuItem1” and “SubMenuItem2” under “MenuItem1”.
It first defines three RibbonMenu items (lr_MenuItem1, lr_SubMenuItem1,
lr_SubMenuItem2) with various properties (including binding with
“Ue_MenuItem1Clicked” and “Ue_MenuItem1Selected” user events), and then
inserts lr_MenuItem1 as the menu item, and lr_SubMenuItem1 and
lr_SubMenuItem2 as the submenu items.

See also

AddSeparatorItem

DeleteItem

GetItem

GetItemCount

InsertItemFirst

InsertItemLast

SetItem


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x