In this example, PAD( ) is used to pass a menu title to a procedure.
The current Visual FoxPro 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 a menu title is chosen, PAD( ) is used to pass the menu title to the procedure named choice
. choice
displays the menu title chosen and the name of the menu bar. If you choose the Exit menu title, the original Visual FoxPro system menu is restored.
*** Name this program PADEXAM.PRG ***
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 padexam WITH PAD( ), MENU( )
PROCEDURE choice
PARAMETERS gcPad, gcMenu
WAIT WINDOW 'You chose ' + gcPad + ;
' from menu ' + gcMenu NOWAIT
IF gcPad = 'PADEXIT'
SET SYSMENU TO DEFAULT
ENDIF