User Tools

Site Tools


additemmimic_tie_menu_item_to_a_button_.htm
Navigation:  ABC Library Reference > PopupClass > PopupClass Methods >====== AddItemMimic (tie menu item to a button) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

AddItemMimic( name, button [, text ] ), PROC

blk2blue.jpg

AddItemMimic Associates a menu item with a BUTTON.
name A string constant, variable, EQUATE, or expression containing the menu item name to associate with the button. If the named item does not exist, AddItemMimic adds it at the bottom of the popup menu. To add a new item, the button must have text, or you must supply the text parameter.
button A numeric constant, variable, EQUATE, or expression containing the associated BUTTON's control number. If the button has no text, you should supply the text parameter.
text A string constant, variable, EQUATE, or expression containing the text of the menu item. 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, AddItemMimic uses the button text as the text of the menu item.

The AddItemMimic method associates a menu item with a button and returns the name of the item. AddItemMimic can add a new menu item, or add an association to an existing menu item. The associated menu item text matches the button text, is enabled only when the button is enabled, and, when selected, invokes the button action.

Implementation:

The Ask method traps the selected item and POSTs an EVENT:Accepted to the button.

If button does not represent a BUTTON, AddItemMimic does nothing.

The text and name parameters accept up to 1024 characters.

Return Data Type:     STRING

Example:

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

PopupMgr.AddItemMimic('Save',?Save)     !Save item mimics ?Save button

PopupMgr.AddItemMimic('Insert',?Insert) !add Insert item/mimic ?Insert button

See Also:     AddItem, AddMenu, Ask, SetText

additemmimic_tie_menu_item_to_a_button_.htm.txt · Last modified: 2021/04/15 15:56 by 127.0.0.1