| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > PopupClass > PopupClass Methods >====== AddItemMimic (tie menu item to a button) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[additemevent set menu item action .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[addmenu add a menu .htm|{{btn_next_n.gif|Next page}}]] | | || **AddItemMimic( **//name, button //[, //text //]// //**), PROC** {{blk2blue.jpg|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 add menu item .htm|AddItem]], [[addmenu add a menu .htm|AddMenu]], [[ask display the popup menu .htm|Ask]], [[settext set menu item text .htm|SetText]]