Define Menu, Define Pad, Define Popup, Define Bar, Release Menus, Release Pad, Release Popups, Release Bar
These commands create and destroy the components of a Windows-style menu. See Menus for an explanation of the various components.Because the Menu Designer generates the DEFINE commands for you and the RELEASEs aren't needed when you're dealing with the system menu bar, you'll rarely write these commands yourself. This is somewhat less true in VFP 7, where new capabilities for menu bars may lead you to write some menu handling code yourself.
Usage |
DEFINE MENU MenuBarName [ BAR [ AT LINE nRow ] ] [ IN [ WINDOW ] ContainingWindow | IN SCREEN ] [ FONT cFontName [, nFontSize ] ] [ STYLE cStyleCodes ] [ KEY KeyLabel ] [ MARK cMarkCharacter ] [ MESSAGE cMessageText ] [ NOMARGIN ] [ COLOR SCHEME nScheme | COLOR ColorPairList ] RELEASE MENUS [ MenuBarList [ EXTENDED ] ] DEFINE PAD PadName1 OF MenuBarName PROMPT cPadText [ AT nRow, nColumn ] [ BEFORE PadName2 | AFTER PadName3 ] [ NEGOTIATE PositionInVFP [, PositionInActiveDoc ] ] [ FONT cFontName [, nFontSize ] ] [ STYLE cStyleCodes ] [ KEY KeyLabel [, cKeyText ] ] [ MARK cMarkCharacter ] [ SKIP [ FOR lExpression ] ] [ MESSAGE cMessageText ] [ COLOR SCHEME nScheme | COLOR ColorPairList ] RELEASE PAD PadName | ALL OF MenuBarName DEFINE POPUP PopupName [ FROM nTop, nLeft ] [ TO nBottom, nRight ] [ IN [ WINDOW ] ContainingWindow | IN SCREEN ] [ FONT cFontName [, nFontSize ] ] [ STYLE cStyleCodes ] [ PROMPT FIELD FieldName | PROMPT FILES [ LIKE FileSkeleton ] | PROMPT STRUCTURE ] [ TITLE cMenuTitleText ] [ FOOTER cFooterText ] [ KEY KeyLabel ] [ MESSAGE cMessageText ] [ MARGIN ] [ MARK cMarkCharacter ] [ MOVER ] [ MULTISELECT ] [ SCROLL ] [ SHORTCUT ] [ RELATIVE ] [ SHADOW ] [ COLOR SCHEME nScheme | COLOR ColorPairList ] RELEASE POPUPS [ PopupList [ EXTENDED ] ] DEFINE BAR nBarNumber1 | SystemItemName OF PopupName PROMPT cBarText [ PICTURE cPictureFile | PICTRES nSystemBar ] [ BEFORE nBarNumber2 | AFTER nBarNumber3 ] [ FONT cFontName [, nFontSize ] ] [ STYLE cStyleCodes ] [ KEY KeyLabel [, cKeyText ] ] [ MARK cMarkCharacter ] [ MESSAGE cMessageText ] [ SKIP [ FOR lExpression ] ] [ COLOR SCHEME nScheme | COLOR ColorPairList ] [ MRU ] [ INVERT ] RELEASE BAR nBarNumber | SystemItemName | ALL OF PopupName |
.F. MRUIn VFP 7, GenMenu.PRG removes any SKIP FOR .F. clauses from DEFINE BAR commands (leaving any following clauses), so there's no longer a performance penalty for tricking the designer in this way.Some of the other common clauses are discussed under Menus.
Example |
DEFINE MENU MyMenu FONT "Arial",14 STYLE "I" DEFINE PAD MyFirst OF MyMenu PROMPT "First" DEFINE PAD MySecond OF MyMenu PROMPT "Second" DEFINE POPUP MyPop1 DEFINE BAR 1 OF MyPop1 PROMPT "Item 1" DEFINE BAR 2 OF MyPop1 PROMPT "Item 2" DEFINE POPUP MyPop2 MARGIN DEFINE BAR 1 OF MyPop2 PROMPT "Other 1" FONT "Courier New",12 DEFINE BAR 2 OF MyPop2 PROMPT "Other 2" ; PICTURE HOME() + "FFC\GRAPHICS\HYPERLINK.ICO" DEFINE BAR 3 OF MyPop2 PROMPT "Other 3" PICTRES _mtl_wzrds ON PAD MyFirst OF MyMenu ACTIVATE POPUP MyPop1 ON PAD MySecond OF MyMenu ACTIVATE POPUP MyPop2 ON SELECTION BAR 1 OF MyPop1 ?"Item 1 chosen" ON SELECTION BAR 2 OF MyPop1 ?"Item 2 chosen" ON SELECTION POPUP MyPop2 ?"Item from Popup2" ON SELECTION BAR 3 OF MyPop2 ?"But I'm different" ACTIVATE MENU MyMenu |
See Also |
Activate Menu, Activate Popup, Deactivate Menu, Deactivate Popup, Menus, On Bar, On Pad, On Selection Bar, On Selection Menu, On Selection Pad, On Selection Popup |