Ask (display the popup menu)

Top  Previous  Next

 

Ask( [x] [,y] ), PROC

Ask

Returns the selected popup menu item name.

x

An integer constant, variable, EQUATE, or expression that specifies the horizontal position of the top left corner of the menu. If omitted, the menu appears at the current cursor position.

y

An integer constant, variable, EQUATE, or expression that specifies the vertical position of the top left corner of the menu. If omitted, the menu appears at the current cursor position.

The Ask method displays the popup menu, performs any action set by AddItemEvent or AddItemMimic for the selected item, then returns the selected item's name. The AddItem, AddItemMimic, or AddMenu method sets the item name.

Return Data Type:     STRING

Example:

MenuChoices EQUATE('&Save Menu|&Restore Menu|-|&Close')!declare menu definition string

CODE

PopupMgr.AddMenu(MenuChoices)                       !add Popup menu

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

PopupMgr.AddItemEvent('Close',EVENT:Accepted,?Close)!Close POSTs event to a control

!program code

IF PopupMgr.Ask() = 'RestoreMenu'                   !if RestoreMenu item selected

 PopupMgr.Restore('MyMenu')                         !code your own functionality

ELSE                                                !if any other item selected

END                                                 !Ask automatically handled it

See Also:     AddItem, AddItemMimic, AddMenu