Partager via


MRKPAD( ) Function

Determines whether a menu title on a user-defined menu bar or on the Visual FoxPro system menu bar is marked.

MRKPAD(cMenuBarName, cMenuTitleName)

Return Values

Logical

Parameters

  • cMenuBarName
    Specifies the name of the menu bar containing the menu title.
  • cMenuTitleName
    Specifies the name of the menu title.

Remarks

Use SET MARK OF to mark or unmark a menu title.

If the specified menu title is marked, MRKPAD( ) returns true (.T.); otherwise, MRKPAD( ) returns false (.F.).

Example

The following program example, named MARKPAD.PRG, uses MRKPAD( ) to toggle the mark character of a menu title when you choose it.

The current system menu bar is first saved to memory with SET SYSMENU SAVE, and all the system menu items are removed with SET SYSMENU TO.

Several system menu items are created with DEFINE PAD. When you choose a menu item, the choice procedure is executed. choice displays the name of the menu item you choose and the name of the menu bar. SET MARK OF is used with MRKPAD( ) to display or remove the menu item's mark character. If you choose the Exit menu, the original Visual FoxPro system menu is restored.

** Name this program MARKPAD.PRG ** CLEAR SET SYSMENU SAVE SET SYSMENU TO SET MARK OF MENU _MSYSMENU TO CHR(4) PUBLIC glMarkPad glMarkPad = .T. 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 markpad WITH PAD( ), MENU( )

PROCEDURE choice
PARAMETER gcPad, gcMenu
WAIT WINDOW 'You chose ' + gcPad + ;
   ' from menu ' + gcMenu NOWAIT
SET MARK OF PAD (gcPad) OF _MSYSMENU TO ;
   ! MRKPAD('_MSYSMENU', gcPad)
glMarkPad= ! glMarkPad
IF gcPad = 'PADEXIT'
   SET SYSMENU TO DEFAULT
ENDIF

See Also

MRKBAR( ) | SET MARK OF