MENU( ) Function

JavaScript Editor js editor     Web development 



Main Page

Returns the name of the active menu bar as an uppercase character string.

MENU(В )

Return Value

Character

Remarks

MENU(В ) returns an empty string if no menu is active. Use the Menu Designer to create a menu and activate it.

Example

The following example uses MENU(В ) to pass the name of a menu bar to a procedure. The current system menu bar is saved to memory with SET SYSMENU SAVE, and all system menu titles are removed with SET SYSMENU TO.

Several system menu titles are created with DEFINE PAD. When you choose a menu title, MENU(В ) passes the name of the Microsoft Visual FoxPro system menu bar, _MSYSMENU, to the choice procedure. The choice procedure displays the name of the menu title you chose and the name of the system menu bar. If you choose the Exit menu, the original Visual FoxPro system menu is restored.

В Copy Code
*** Save this program as MENUEXAM.PRG in the default VFP directory.***
CLEAR
SET SYSMENU SAVE   
SET SYSMENU TO     
DEFINE PAD padSys OF _MSYSMENU PROMPT '\<System' COLOR SCHEME 3 ;
   KEY ALT+S, '' 
DEFINE PAD padEdit OF _MSYSMENU PROMPT '\<Edit' COLOR SCHEME 3 ;
   KEY ALT+E, '' 
DEFINE PAD padRecord OF _MSYSMENU PROMPT '\<Record' COLOR SCHEME 3 ;
   KEY ALT+R, '' 
DEFINE PAD padWindow OF _MSYSMENU PROMPT '\<Window' COLOR SCHEME 3 ;
   KEY ALT+W, '' 
DEFINE PAD padReport OF _MSYSMENU PROMPT 'Re\<ports' COLOR SCHEME 3 KEY ALT+P, '' 
DEFINE PAD padExit OF _MSYSMENU PROMPT 'E\<xit' COLOR SCHEME 3 ;
   KEY ALT+X, ''
ON SELECTION MENU _MSYSMENU ;
   DO choice IN menuexam WITH PAD(), MENU()
PROCEDURE choice
PARAMETER gcPad, gcMenu
WAIT WINDOW 'You chose ' + gcPad + ;
   ' from menu ' + gcMenu NOWAIT
IF gcPad = 'PADEXIT'
   SET SYSMENU TO DEFAULT
ENDIF

See Also



JavaScript Editor js editor     Web development