Skip to main content
Version: Next

INSERT MENU ITEM

INSERT MENU ITEM ( menu ; afterItem ; itemText {; subMenu {; process}}{; *} )

ParameterTypeDescription
menuLongint🡒Menu number or Menu reference
afterItemLongint🡒Menu item number
itemTextString🡒Text for the menu item to be inserted
subMenuMenuRef🡒Reference of submenu associated with item
processLongint🡒Process reference number
*Operator🡒If passed: consider metacharacters as standard characters

Description

The INSERT MENU ITEM command inserts new menu items into the menu whose number or reference is passed in menu after the existing menu item whose number is passed in afterItem.

If you omit the process parameter, INSERT MENU ITEM applies to the menu bar for the current process. Otherwise, the command applies to the menu bar for the process whose reference number is passed in process.

Note: If you pass a MenuRef in menu, the process parameter serves no purpose and will be ignored.

If you do not pass the * parameter, INSERT MENU ITEM allows to you insert one or several menu items in one call.

INSERT MENU ITEM works like APPEND MENU ITEM, except that it enables you to insert items anywhere in the menu, while APPEND MENU ITEM always adds them at the end of the menu.

See the description of the APPEND MENU ITEM command for details about the item definition passed in itemText and about the action of the * parameter.

Note: The ak standard action title constant is supported in the itemText parameter (4D v16 R3 and higher).

The optional subMenu parameter can be used to indicate a menu as the added item and thus position a hierarchical submenu. You must pass a menu reference (MenuRef type string) specifying a menu created, for example, using the Create menu command. If the command adds more than one menu item, the submenu is associated with the first item.

Important: The new items do not have any associated methods or actions. These must be associated with the items using the SET MENU ITEM PROPERTY or SET MENU ITEM METHOD commands, or the items can also be managed from within a form method using the Menu selected command.

Example

The following example creates a menu consisting of two commands to which it assigns a method:

 menuRef:=Create menu
 APPEND MENU ITEM(menuRef;"Characters")
 SET MENU ITEM METHOD(menuRef;1;"CharMgmtDial")
 INSERT MENU ITEM(menuRef;1;"Paragraphs")
 SET MENU ITEM METHOD(menuRef;2;"ParaMgmtDial")

See also

APPEND MENU ITEM
SET MENU ITEM PARAMETER