DEFINE MENU Command

Creates a menu bar.

DEFINE MENU MenuBarName [BAR [AT LINE nRow]]
   [IN [WINDOW] WindowName | IN SCREEN]
      [FONT cFontName [, nFontSize [, nFontCharSet]]]
   [STYLE cFontStyle] [KEY KeyLabel] [MARK cMarkCharacter]
   [MESSAGE cMessageText] [NOMARGIN] 
   [COLOR SCHEME nSchemeNumber | COLOR ColorPairList]

Parameters

MenuBarName

Specifies the name of the menu bar to create. The menu bar name allows you to reference the menu bar in other commands and functions.

BAR [AT LINE nRow]

Creates a menu bar that behaves like the Visual FoxPro system menu bar. The menu bar has these characteristics:

  • A horizontal menu bar one line high is drawn across the width of the main Visual FoxPro window or the user-defined window it is placed in.

  • The placement of the menu titles on the menu bar is handled automatically.

  • If the size or number of menu titles you define exceeds the size of the screen or a window in which the menu bar is placed, the menu bar scrolls.

The row number is specified with nRow.

IN [WINDOW] WindowName

Places a menu bar in a user-defined window. Specify the name of the window in which you want to place the menu bar with WindowName. If you omit IN WINDOW, the menu bar is placed in the main Visual FoxPro window by default unless there is an active user-defined window. If there is an active user-defined window, the menu bar is placed in the active window. This clause is supported only in top-level forms which can be set with ShowWindow=2 or Desktop=.T.

IN SCREEN

Explicitly places the menu bar in the main Visual FoxPro window.

FONT cFontName[, nFontSize [, nFontCharSet]]

Specifies a default font for all menu titles in the menu bar. You can override the default font for an individual menu title by including the FONT clause in DEFINE PAD.

cFontName specifies the name of the font, and nFontSize specifies the point size. You can specify a language script with nFontCharSet. See the GETFONT( ) Function for a list of available language script values.

For example, the following command creates a menu bar with menu titles in 12-point Courier font:

 CopyCode imageCopy Code
DEFINE MENU mnuExample FONT 'Courier', 12

If the font you specify is not available, a font with similar font characteristics is substituted. If you include the FONT clause but omit the point size nFontSize, a 10-point font is used.

The FONT clause is ignored for menu titles added to the Visual FoxPro system menu _MSYSMENU. Note that the Menu Designer uses the Visual FoxPro system menu.

STYLE cFontStyle

Specifies a default font style for all the menu titles in the menu bar. You can override the default style for individual menu titles by including the STYLE clause in DEFINE PAD.

If you omit the STYLE clause, or if the font style you specify is not available, the Normal font style is used.

The font styles you can specify with cFontStyle are as follows:

Character Font style

B

Bold

I

Italic

N

Normal

Q

Opaque

-

Strikeout

T

Transparent

U

Underline

You can include more than one character to specify a combination of font styles. For example, the following command specifies Bold Italic:

 CopyCode imageCopy Code
DEFINE MENU mnuExample STYLE 'BI'

The STYLE clause is ignored for menu titles added to the Visual FoxPro system menu _MSYSMENU. The Menu Designer uses the Visual FoxPro system menu.

KEY KeyLabel

Specifies the key or key combination used to activate the menu bar. For a list of available keys and key combinations and their key label names, see ON KEY LABEL Command.

Including the KEY clause is equivalent to issuing the following command:

 CopyCode imageCopy Code
ON KEY LABEL KeyLabel ACTIVATE MENU MenuName
NoteNote

If a keyboard macro is already defined with the same key label, the keyboard macro takes precedence, and the menu bar cannot be activated with the specified key or key combination.

MARK cMarkCharacter

Specifies a mark character that appears to the left of the menu titles on the menu bar. MARK can be included to change the default mark character to a character specified with cMarkCharacter. If cMarkCharacter includes more than one character, only the first character is used as the mark character.

The default mark character is a check. The MARK clause is ignored and the default mark character is used if the menu bar is the Visual FoxPro system menu. Also, the MARK clause is ignored if FoxFont isn't the font for the main Visual FoxPro window or the user-defined window in which the menu bar is placed.

NoteNote

Specifying a mark character doesn't mark the menu names on a menu bar. Use SET MARK OF to mark the menu titles on a menu bar with the character you specify.

Mark characters specified with DEFINE PAD take precedence over mark characters specified with the MARK clause in DEFINE MENU. SET MARK OF is used to toggle mark characters on or off, and can also be used to specify a mark character for an individual menu item or for all menu items.

MESSAGE cMessageText

Displays a message when the user selects a menu title. The message is placed in the graphical status bar. If the graphical status bar is turned off with SET STATUS BAR OFF, the message is centered on the last line of the main Visual FoxPro window.

NOMARGIN

Removes the spaces that are placed to the left and right of each menu name by default.

COLOR SCHEME nSchemeNumber

Specifies the colors for an individual menu bar.

COLOR ColorPairList

Specifies the colors for an individual menu bar. By default, the colors of menu items are determined by color scheme 2 of the current color set.

Expand imageRemarks

Expand imageExample

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic