Share via


DEACTIVATE MENU Command

Deactivates a user-defined menu bar and removes it from the screen; but does not remove the menu-bar definition from memory.

DEACTIVATE MENU MenuName1 [, MenuName2 ...] | ALL

Parameters

  • MenuName1[, MenuName2...]
    Specifies the names of the menu bars to deactivate. You can deactivate a set of menu bars by including a list of menu bar names separated by commas.

  • ALL
    Deactivates all active menus.

Remarks

DEACTIVATE MENU removes an active menu bar or set of menu bars from the main Visual FoxPro window or a user-defined window without removing the menu bar definition from memory. A menu bar can be reactivated with ACTIVATE MENU and the menu bar name.

Tip

When you include the system menu bar (_MSYSMENU) in an application, you do not need to define, activate, or deactivate the menu bar. Instead, issue SET SYSMENU AUTOMATIC.

To release a specific menu bar or a set of menu bars from memory, use RELEASE MENUS. You can release all menu bars from memory with CLEAR MENUS or CLEAR ALL.

Program control is returned to the program line immediately following the line that activated the menu bar unless DEFINE MENU BAR is used to create the menu bar or ACTIVATE MENU NOWAIT is used to activate the menu bar.

Example

The following example uses DEACTIVATE MENU to deactivate a menu and remove it from the screen. The current system menu bar is saved to memory with SET SYSMENU SAVE, and all the system menu titles are removed with SET SYSMENU TO.

Two menu titles are created with DEFINE PAD, and DEFINE POPUP creates a menu for each menu title. DEFINE BAR creates menu items on each of the menus. When a menu title is chosen, ON PAD uses ACTIVATE POPUP to activate the corresponding menu. ACTIVATE MENU displays and activates the menu bar.

When an item is chosen from a menu, the CHOICE procedure is executed. CHOICE displays the name of the chosen item and the name of the menu containing the item. Program control continues on the line after ACTIVATE MENU.

Finally, the menu is deactivated and removed from the screen and is then released from memory with RELEASE MENUS EXTENDED.

** Name this program DEACMENU.PRG ** CLEAR SET SYSMENU SAVE SET SYSMENU TO ON KEY LABEL ESC KEYBOARD CHR(13) DEFINE MENU example BAR AT LINE 1 DEFINE PAD convpad OF example PROMPT '<Conversions' COLOR SCHEME 3 ; KEY ALT+C, '' DEFINE PAD cardpad OF example PROMPT 'Card <Info' COLOR SCHEME 3 ; KEY ALT+I, '' ON PAD convpad OF example ACTIVATE POPUP conversion ON PAD cardpad OF example ACTIVATE POPUP cardinfo DEFINE POPUP conversion MARGIN RELATIVE COLOR SCHEME 4 DEFINE BAR 1 OF conversion PROMPT 'Ar<ea' ; KEY CTRL+E, '^E' DEFINE BAR 2 OF conversion PROMPT '<Length' ; KEY CTRL+L, '^L' DEFINE BAR 3 OF conversion PROMPT 'Ma<ss' ; KEY CTRL+S, '^S' DEFINE BAR 4 OF conversion PROMPT 'Spee<d' ; KEY CTRL+D, '^D' DEFINE BAR 5 OF conversion PROMPT '<Temperature' ; KEY CTRL+T, '^T' DEFINE BAR 6 OF conversion PROMPT 'T<ime' ; KEY CTRL+I, '^I' DEFINE BAR 7 OF conversion PROMPT 'Volu<me' ; KEY CTRL+M, '^M' ON SELECTION POPUP conversion DO choice IN deacmenu WITH PROMPT( ), POPUP( ) DEFINE POPUP cardinfo MARGIN RELATIVE COLOR SCHEME 4 DEFINE BAR 1 OF cardinfo PROMPT '<View Charges' ; KEY ALT+V, '' DEFINE BAR 2 OF cardinfo PROMPT 'View <Payments' ; KEY ALT+P, '' DEFINE BAR 3 OF cardinfo PROMPT 'Vie<w Users' ; KEY ALT+W, '' DEFINE BAR 4 OF cardinfo PROMPT '-' DEFINE BAR 5 OF cardinfo PROMPT '<Charges ' ON SELECTION POPUP cardinfo; DO choice IN deacmenu WITH PROMPT( ), POPUP( )

ACTIVATE MENU example
DEACTIVATE MENU example
RELEASE MENU example EXTENDED
SET SYSMENU NOSAVE
SET SYSMENU TO DEFAULT
ON KEY LABEL ESC

PROCEDURE choice
PARAMETERS mprompt, mpopup
WAIT WINDOW 'You chose ' + mprompt + ;
   ' from popup ' + mpopup NOWAIT

See Also

Reference

ACTIVATE MENU Command

CLEAR Commands

CLEAR Commands

CREATE MENU Command

DEFINE MENU Command

HIDE MENU Command

RELEASE Command

SHOW MENU Command

Other Resources

Commands (Visual FoxPro)

Language Reference (Visual FoxPro)