On Bar, On Pad, On Selection Bar, On Selection Menu, On Selection Pad, On Selection Popup

These commands are the key to making your menus do something. The DEFINE commands set up the menus and the ACTIVATE commands turn them on, but without the ON and ON SELECTION commands, not much happens after that.The ON BAR and ON PAD commands let one menu component activate another component. The ON SELECTION commands are much broader—they let you specify anything at all to happen when a particular item is chosen.

Usage

ON BAR nBar OF PopupName [ ACTIVATE POPUP SubPopupName |
        ACTIVATE MENU SubMenuName ]
ON PAD PadName OF MenuName [ ACTIVATE POPUP PopupName |
        ACTIVATE MENU SubMenuName ]
With hierarchical menus, choosing a pad of a menu generally opens a popup. Choosing a bar from a menu popup sometimes leads to another popup. That's what ON BAR and ON PAD are about. When a menu bar calls another popup, FoxPro takes care of putting in the little arrow that indicates a nested menu.We've never used the ACTIVATE MENU alternative here and it violates every menu standard we know of, so we don't plan to start using it anytime soon.

Example

* From the system menu:
ON PAD _MSM_FILE OF _MSYSMENU ACTIVATE POPUP _MFILE

Usage

ON SELECTION BAR nBar OF PopupName [ Command ]
ON SELECTION MENU MenuName | ALL [ Command ]
ON SELECTION PAD PadName OF MenuName [ Command ]
ON SELECTION POPUP PopupName | ALL [ Command ]
The MENU and POPUP versions of these propagate down one level to their contained pads and bars. You can then override those choices for individual bars and pads. ON PAD and ON BAR commands take precedence over ON SELECTION BAR and ON SELECTION PAD. That is, if you specify both for a bar or pad, the popup or menu you specified gets activated when the bar or pad is chosen. The code specified in ON SELECTION is ignored.

Example

USE Employee
DEFINE POPUP EmpPop ;
   PROMPT FIELDS TRIM(First_Name - (" " + Last_Name))
ON SELECTION POPUP EmpPop WAIT WINDOW "You picked "+PROMPT()

See Also

Activate Menu, Activate Popup, Define Bar, Define Menu, Define Pad, Define Popup, Menus


Back to Table of Contents

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