Activate Menu, Deactivate Menu, Activate Popup, Deactivate Popup

These commands do exactly what their names suggest. They turn on and off menu bars and menu popups. You're unlikely to ever need to issue the MENU versions of these commands—the Menu Designer handles all that. You might use the POPUP versions for context menus, but even there, mostly the Menu Designer takes care of this stuff.

Usage

ACTIVATE MENU MenuName [ NOWAIT ] [ PAD PadName ]
ACTIVATE POPUP PopupName [ AT nRow, nColumn ]
         [ BAR nMenuItemNumber ]
         [ NOWAIT ] [ REST ]
DEACTIVATE MENU MenuList | ALL
DEACTIVATE POPUP PopupList | ALL
The ACTIVATE commands here start a wait state (unless you include NOWAIT). When the corresponding DEACTIVATE is issued, control returns to the line following the ACTIVATE. With NOWAIT, it doesn't work that way. Instead, execution continues after the ACTIVATE, and the DEACTIVATE simply deactivates the thing and doesn't send control anywhere else.The AT clause of DEFINE POPUP is a key to defining context menus. The row and column coordinates are specified in foxels. If your form's ScaleMode is pixels (as it should be), you'll need to do some conversion to place the popup where you want it. However, you shouldn't need to do this, except in VFP 3. In later versions, the Menu Designer can handle all this for you.The BAR clause lets you decide which item in the popup is initially highlighted. It doesn't work for system menu popups, only for those you define yourself. That's okay because, except in demos, it's not the Windows way to choose a bar for the user.

Example

* We wouldn't really do this in VFP though we did things
* like it all the time in FoxPro 2.x.
USE Employee
DEFINE POPUP EmpPop PROMPT FIELD ;
   TRIM(First_Name) + " " + TRIM(Last_Name)
ON SELECTION POPUP EmpPop DO Whozat
ACTIVATE POPUP EmpPop AT 0,10
RELEASE POPUP EmpPop
 
PROCEDURE Whozat
WAIT WINDOW "You picked " + PROMPT()
DEACT POPUP EmpPop
RETURN

See Also

Define Menu, Define Popup, Menus, On Selection Menu, On Selection Popup, Release Menus, Release Popups


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .