CreateMenuItem command

The CreateMenuItem command inserts a new menu item into a menu or menu bar at specified position.

 

Syntax

Integer=MenuHandle

String$='ItemText, ItemPosition, ModifyFlags'

PluginSet("PlugIn","Integer")

PluginSet("PlugIn","String$")

PluginRun("PlugIn","CreateMenuItem")

PluginGet("PlugIn","MenuItemID/MenuHandle")

Parameters

MenuHandle

[in] Handle to the menu to be changed. It can be popup/drop-down menu handle, submenu handle or one of two predefined values:

 

0

Indicates that menu item will be inserted into the menu bar.

1

Indicates that menu item will be inserted into the system menu.

ItemText

[in] Specifies the text of the new menu item. Value '-' in this parameter indicates that the new menu item is separator.

Beside menu item text this parameter can specify access key for the menu item. An access key is an underlined letter in the text of a menu item. When a menu is active, the user can select a menu item by pressing the key that corresponds to the item's underlined letter.

To create an access key for a menu item, precede any character in the item's text string with an ampersand. For example, the text string "&Close" causes the system to underline the letter "C".

In addition to having an access key, a menu item can have a shortcut key associated with it. A shortcut key is different from an access key, because the menu does not have to be active for the shortcut key to work. You can specify shortcut key as part of ItemText parameter.

Text that identifies the shortcut key is added to the menu item text string. The shortcut text appears to the right of the menu item name, after tab character (CHR(9)).

ItemPosition

[in] Zero-based relative position of the menu item. This parameter is optional and can be omitted. In this case the new menu item is appended to the end of the menu.

ModifyFlags

[in] Currently the only modifying flag that has been defined for this command is SUBMENU. Adding this flag indicates that newly created item opens submenu. The output variable in this case contains the handle of a new submenu.

MenuItemID/MenuHandle

[out] The unique identifier of the new menu item. If SUBMENU flag was specified in ModifyFlags parameter, this variable contains the handle of a new submenu.