ON BAR Command

Example   See Also

Specifies a menu or menu bar that is activated when you choose a specific menu item from a menu.

Syntax

ON BAR nMenuItemNumber OF MenuName1
  [ACTIVATE POPUP MenuName2
  | ACTIVATE MENU MenuBarName]

Arguments

nMenuItemNumber OF MenuName1

Specifies the menu item number and menu of the menu item that activates another menu or menu bar. Each item in a menu can have another menu or menu bar assigned to it.

A menu item with a menu or menu bar assigned to it has an arrow placed to the right of the menu item. The arrow indicates that choosing that menu item activates an additional menu or menu bar. An additional space for the cascading submenu arrow is placed to the right of each item if you define the menu with DEFINE POPUP ... MARGIN. If you create the menu without the MARGIN clause, the cascading submenu arrow might overwrite the last character of the menu item.

ACTIVATE POPUP MenuName2

Specifies the name of the menu to activate when the menu item is chosen. Use ON BAR without ACTIVATE POPUP to release a menu from a menu item.

ACTIVATE MENU MenuBarName

Specifies the name of the menu bar to activate when the menu item is chosen. Use ON BAR without ACTIVATE MENU to release a menu bar from a menu item.

Remarks

A menu that displays and activates another menu is called a cascading submenu. Use ON SELECTION BAR or ON SELECTION POPUP to execute a command when an item is chosen from a menu.

The menus and menu bar can be user-defined (created with DEFINE POPUP and DEFINE MENU) or part of the Visual FoxPro menu system.