AddItemEvent (set menu item action) 

Top  Previous  Next

 

AddItemEvent( name, event [,control] ), PROC

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, AddItemMimic, AddMenu, Ask