Aracılığıyla paylaş


PAD( ) Function

Returns as an uppercase character string the menu title most recently chosen from a menu bar, or returns a logical value indicating if a menu title is defined for an active menu bar.

PAD([cMenuTitle [, cMenuBarName]])

Parameters

  • cMenuTitle
    Specifies the name of a menu title in a menu bar. Include this argument to test if the menu title is defined for an active menu bar. A logical true (.T.) is returned if the menu title is defined; otherwise a logical false (.F.) is returned.

  • cMenuBarName
    Specifies the name of the menu bar containing the menu title cMenuTitle. If cMenuBarName is omitted, the menu title is assumed to be in the currently active menu bar.

Return Value

Character or Logical

Remarks

A menu bar must be defined and active for PAD( ) to return a menu title. Menu bars are created and activated with DEFINE MENU and ACTIVATE MENU.

You can also use PAD( ) with the Visual FoxPro system menu bar.

PAD( ) (issued without any of its optional arguments) returns an empty string if a menu bar isn't defined and active or you issue PAD( ) from the Command window.

Example

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

See Also

Reference

ACTIVATE MENU Command

BAR( ) Function

DEFINE PAD Command

DEFINE MENU Command

MENU( ) Function

ON PAD Command

ON SELECTION PAD Command

PROMPT( ) Function

Other Resources

Functions