| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > PopupClass > PopupClass Methods >====== AddItemEvent (set menu item action) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[additem add menu item .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[additemmimic tie menu item to a button .htm|{{btn_next_n.gif|Next page}}]] | | || **AddItemEvent( **//name, event// [,//control//]// //**), PROC** {{blk2blue.jpg|blk2blue.jpg}} | **AddItemEvent** | Associates an event with a menu item. | | //name// | A string constant, variable, EQUATE, or expression containing the name of the menu item associated with the //event//. If the named item does not exist, AddItemEvent adds it at the bottom of the popup menu. | | //event// | An integer constant, variable, EQUATE, or expression containing the event number to POST when the end user selects the menu item. | | //control// | An integer constant, variable, EQUATE, or expression containing the control number to POST the //event //to when the end user selects the menu item. To post a field-independent event, use a //control //value of zero (0). If omitted, //control //defaults to zero (0). | The **AddItemEvent **method associates an //event //with a menu item and returns the name of the item. When the end user selects the menu item, the PopupClass object POSTs the //event //to the //control//. **Implementation:** The Ask method traps the selected item and POSTs the //event//. The //name //parameter accepts up to 1024 characters. **Return Data Type:     **STRING **Example:** ** PopupMgr.AddItem('Close (control event)','Close')   !add a menu item: Close** ** PopupMgr.AddItemEvent('Close',EVENT:Accepted,?Close)!Close POSTs event to a control** ** PopupMgr.AddItem('Close (window event)','Close2')   !add a menu item: Close2** ** PopupMgr.AddItemEvent('Close2',EVENT:CloseWindow,0) !Close2 POSTs independent event** **See Also:     **[[additem add menu item .htm|AddItem]], [[additemmimic tie menu item to a button .htm|AddItemMimic]], [[addmenu add a menu .htm|AddMenu]], [[ask display the popup menu .htm|Ask]]