Menu Item

 

A Menu Item can be displayed on a Menu Bar or as a menu item associated with a drop-down, context menu or submenu.  Dropdown menus are created by placing the name of a Menu Item displayed in the Menu Bar in the parent attribute of the menu item's template entry.  A submenu is started by placing the name of a Menu Item other than a menu bar displayed menu item in the parent attribute.

Context menus are usually activated by right-clicking the client area of a control or dialog.  Create context menus by specifying the name of a control in the parent attribute.  If you use the DEFAULT key word as the Menu Item parent, the context menu will by associated with the dialog and display when the user right clicks on an 'empty' area of the dialog or on any control that does not already have a system or template supplied context menu.

 

menuitem.bmp

 

The resulting WIL Dialog will look something like this:

 

DialogMenu.JPG

 

Limitations:

NT 4.0  limitations:

The dialog size may not be properly adjusted to account for multi row menu bar when a menu bar displays enough menu items to cause the menu bar to automatically wrap to a new row.

Context menus may not work when associated with a Drop-down Combo Box controls.

 

 

Control Attributes

WIL Dialog - Menu Editor

 

Calendar

Check Box

Com Control

DateTime

Drop-down Combo Box

Edit Box

File List Box

Group Box

Item List Box

Menu Bar

Menu Item

Multiline Edit Box

Picture

Picture Button

Push Button

Radio Button

Report View

Spinner

Static Text

Variable Text

 

 

 

For example, the lines in the script generated by the WIL Dialog Editor may look like:

 

MyDialog003=`000,000,000,000,MENUBAR,"Dialog_Bar"`

MyDialog004=`000,000,000,000,MENUITEM,"mbi1_File","Dialog_Bar","File",DEFAULT,10,DEFAULT`

MyDialog005=`000,000,000,000,MENUITEM,"mbi2_RunNotepad","mbi1_File","Run Notepad",DEFAULT,10,DEFAULT`

 

 

Simple Example


#DefineFunction MyDialogCallbackProc(MyDialog_Handle,MyDialog_Message,MyDialog_Name,MyDialog_EventInfo,rsvd) Switch MyDialog_Message ; Switch based on Dialog Message type Case @deInit ; Standard Initialization message DialogProcOptions(MyDialog_Handle,@dePbPush,@true) DialogProcOptions(MyDialog_Handle,@deMiSelect,@true) Return(@retdefault) Case @dePbPush If MyDialog_Name == "PushButton_RightClickMe" ; Right Click Me! Pause('Notice','You left-clicked the button') Return(@retNoExit ) ElseIf MyDialog_Name == "PushButton_Cancel" ; Cancel Pause('Notice','You pressed Cancel') Return(@retCancel) EndIf ; MyDialog_Name Return(@retDefault) Case @deMiSelect If MyDialog_Name == "cmi1_PushButton_RightClickMe" ; PushButton_RightClickMe Context Menu One Pause('You Selected:','Context menu One') Return(@retNoExit ) ElseIf MyDialog_Name == "cmi3_PushButton_RightClickMe" ; cmi1_PushButton_RightClickMe Subcontext Menu One Pause('You Selected:','Subcontext menu One') Return(@retNoExit ) ElseIf MyDialog_Name == "cmi2_PushButton_RightClickMe" ; PushButton_RightClickMe Context menu Two Pause('You Selected:','Context menu Two') Return(@retNoExit ) ElseIf MyDialog_Name == "mbi1_MyDialog" ; Dialog_Bar Menu Item One ;NOTICE : The user-defined callback is not called in response to the mouse selection of menu ;item that have an associated dropdown menus or submenus. The associated dropdown or submenu ;is displayed instead. Hot-keys should not be used with menu items that display a dropdown ;or submenu. Return(@retNoExit ) ElseIf MyDialog_Name == "mbi2_MyDialog" ; mbi1_MyDialog SubMenu Item One Pause('You Selected:','SubMenu item One') Return(@retNoExit ) ElseIf MyDialog_Name == "mbi3_MyDialog" ; Dialog_Bar Menu Item Two Pause('You Selected:','Menu item Two') Return(@retNoExit ) EndIf ; MyDialog_Name Return(@retDefault) EndSwitch ; MyDialog_Message Return(@retDefault) #EndFunction ; End of Dialog Callback MyDialogCallbackProc ;MENUITEMs can be displayed on a menu bar or as a menu item associated with a drop-down, context menu or submenu. ; ;Dropdown menus are created by placing the name of a MENUITEM displayed in the menu bar in the parent attribute ;of the menu item's template entry. A submenu is started by placing the name of a MENUITEM other than a menu bar ;displayed menu item in the parent attribute. ; ;Context menus are usually activated by right-clicking the client area of a control or dialog. Create context ;menus by specifying the name of a control in the parent attribute. If you use the DEFAULT keyword as the ;MENUITEM parent, the context menu will by associated with the dialog and display when the user right clicks on ;an 'empty' area of the dialog or on any control that does not already have a system or template supplied context ;menu. MyDialogFormat=`WWWDLGED,6.2` MyDialogCaption=`Menu Sample` MyDialogX=241 MyDialogY=080 MyDialogWidth=242 MyDialogHeight=116 MyDialogNumControls=009 MyDialogProcedure=`MyDialogCallbackProc` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`073,047,078,012,PUSHBUTTON,"PushButton_RightClickMe",DEFAULT,"Right Click Me!",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`093,093,036,012,PUSHBUTTON,"PushButton_Cancel",DEFAULT,"Cancel",0,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`000,000,000,000,MENUITEM,"cmi1_PushButton_RightClickMe","PushButton_RightClickMe","Context Menu One",DEFAULT,10,DEFAULT` MyDialog004=`000,000,000,000,MENUITEM,"cmi3_PushButton_RightClickMe","cmi1_PushButton_RightClickMe","Subcontext Menu One",DEFAULT,10,DEFAULT` MyDialog005=`000,000,000,000,MENUITEM,"cmi2_PushButton_RightClickMe","PushButton_RightClickMe","Context menu Two",DEFAULT,20,DEFAULT` MyDialog006=`000,000,000,000,MENUBAR,"Dialog_Bar"` MyDialog007=`000,000,000,000,MENUITEM,"mbi1_MyDialog","Dialog_Bar","Menu Item One",DEFAULT,10,DEFAULT` MyDialog008=`000,000,000,000,MENUITEM,"mbi2_MyDialog","mbi1_MyDialog","SubMenu Item One",DEFAULT,10,DEFAULT` MyDialog009=`000,000,000,000,MENUITEM,"mbi3_MyDialog","Dialog_Bar","Menu Item Two",DEFAULT,20,DEFAULT` ButtonPushed=Dialog("MyDialog")