AddItem (add menu item) 

Top  Previous  Next

 

 

AddItem( text

| [,name] | )

 

 

| name, position, level |

AddItem

Adds an item to the popup menu.

text

A string constant, variable, EQUATE, or expression containing the text of the menu item. A single hyphen (-) creates a non-selectable separator (a 3D horizontal bar) on the menu. An ampersand (&) designates the next character as the menu item's hot key.

name

A string constant, variable, EQUATE, or expression containing the menu item name. Other PopupClass methods refer to the menu item by its name, not by its text. This lets you apply runtime translation or dynamic reordering of menus without changing your code. If omitted, AddItem derives the name from the text.

position

A string constant, variable, EQUATE, or expression containing the name after which to add the new menu item.

level

An integer constant, variable, EQUATE, or expression containing the nesting level or depth of the new menu item.

The AddItem method adds an item to the popup menu.

You set the action taken for each menu item with the AddItemMimic or AddItemEvent methods, or with your own custom code. These methods (and your code) must refer to the menu items by name (not by text).

AddItem(text)

Adds a single menu item at the end of the menu. The item name is derived.

AddItem(text, name)

Adds a single menu item at the end of the menu with the name specified.

AddItem(text, name, position, level)

Adds a single menu item following item position, at level level, with name specified.

Implementation:

The text and name parameters accept up to 1024 characters.

Each derived menu item name is the same as its text minus any special characters. That is, the name contains only characters 'A-Z', 'a-z', and '0-9'. If the resulting name is not unique, the PopupClass appends a sequence number to the name to make it unique.

Example:

PopupMgr.AddItem('Save Popup')            !add menu item named SavePopup

PopupMgr.AddItem('Save Popup','Save')     !add menu item named Save

PopupMgr.AddItem('-','Separator')         !add a separator

PopupMgr.AddItem('Restore Popup','Restore','Save',1)!add Restore item after Save item

See Also:     AddItemEvent, AddItemMimic, SetText