Syntax
guiMenu():New( [lPopup] ) --> oMenu
oMenu:AddMenu( cText, [cBitmap] ) --> oSubmenu
oMenu:Add( cText, [bAction], [cShortcut], [cBitmap], [bWhen] ) --> nId
oMenu:AddSeparator() --> oMenuArguments
Arguments are described by the signatures above. Positions and sizes are logical pixels. Optional arguments in brackets use the defaults described below.
Return value
Constructors return the new object unless the syntax states otherwise. Methods returning the object may be chained.
Description
Class members declared by guiMenu:
- Instance variables:
handle(read-only) - Properties: none
- Methods:
New(),AddMenu(),Add(),AddSeparator()
Without lPopup, the object is a menu bar. With .T. it is a context menu. AddMenu() appends a drop-down menu. Add() appends a command and returns its identifier. Its action receives the window. bWhen is evaluated before the command runs and whenever its menu opens; a false value disables the command.
Shortcuts use names such as Ctrl+S, Shift+F5, Del and Esc. A menu bar is assigned to oWindow:menu; a popup menu is assigned to contextMenu.
Notes
guiMenu is part of the gui user library for Windows.
Example
PROCEDURE Main()
LOCAL oWindow := guiWindow():New( "Menu", 420, 180 )
LOCAL oMenu := guiMenu():New()
LOCAL oFile := oMenu:AddMenu( "&File" )
oFile:Add( "E&xit", {|| oWindow:Close() }, "Alt+F4" )
oWindow:menu := oMenu
guiApplication():Run( oWindow )
RETURNOutput