A MENUITEM can be displayed on a MENUBAR or as a MENUITEM associated with a drop-down, context menu or submenu. Drop-down menus are created by placing the name of a MENUITEM displayed in the MENUBAR 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 MENUBAR displayed MEUITEM 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.
WIL Dialogs support both drop down and context menus. The WIL Dialog Menu Editor is provided with the WIL Dialog Editor to help design the menu structure.
Return Value:
The MENUITEM control requires a Dialog Callback Procedure to handle the users selections. The easiest way to accomplish this is:
Control Definition:
<dlg-variable>nn =`x, y, width, height, type, control-name, parent-name, text, value, position, style`
For Example:
Drop-down menus
MyDialog004=`000,000,000,000,MENUITEM,"mbi1_MyDialog","Dialog_Bar","Job 1",DEFAULT,10,DEFAULT`
Attribute
|
Value
|
Meaning
|
dlg-variable
|
MyDialog
|
The name of the dialog box.
|
nn
|
004
|
The ordinal position of the control in the dialog box (starting with 1).
|
x
|
000
|
Not applicable to this control.
|
y
|
000
|
Not applicable to this control.
|
width
|
000
|
Not applicable to this control.
|
height
|
000
|
Not applicable to this control.
|
type
|
MENUITEM
|
The type of control.
|
control-name
|
"mbi1_MyDialog"
|
The name used to identify the control in a user defined callback procedure. The name cannot be more than 30 characters in length and MUST be unique. ( This attribute can only be used with 6.2 or later dialog formats. )
|
parent-name
|
"Dialog_Bar"
|
When you specify a MENUITEM this attribute is used to indicate the name of the control, menu bar, or MENUITEM that hosts this menu item. If you place the DEFAULT keyword in this attribute the item will be a menu item on the dialog's context menu. Likewise, placing the name of a control in this attribute will make the item a menu item of the named control's context menu. Placing the name of the MENUBAR control here will cause the item's text to be displayed in the dialog's menu bar. If you use the name of another MENUITEM, the menu item becomes a menu choice on either a dropdown in the case of top level MENUBAR items or a submenu displayed by the menu item named.
|
text
|
"Job 1"
|
The description which will be displayed with the control. [Use an empty string ("") if the control should appear blank.]
You can associate a shortcut key with a MENUITEM in this attribute by following the item's text with a back slash (\) and a key combination. The key combination is indicated by using the same key descriptions use with the SendKey function.
Note: Short-cut key combination should not be used with menu items that display dropdown menus or submenus. It is not considered good UI design and the menu caption may not display correctly.
|
value
|
DEFAULT
|
Not applicable to this control.
|
position
|
10
|
Indicates the display order of the control on a menu relative to other menu items on the same menu.
|
style
|
DEFAULT
|
Allows you to control the initial appearance and behavior of your control. Numbers represent each style and they can be combined, using the bit-wise OR (|) operator, to set multiple styles. The following table lists the style numbers, their meanings, and the controls that they have an effect on.
Style
|
Meaning
|
@csInvisible (1)
|
Control is invisible
|
@csDisabled (2)
|
Control has disabled appearance and does not accept any user input, it would otherwise accept input.
|
@csMenuCheck (32768)
|
Adds a check mark to the left of a menu item.
|
@csMenuRadio (65536)
|
Adds a radio button-like dot graphic to the left of a menu item.
|
@csMenuSep (131072)
|
Causes a separator bar graphic to display instead of text at the menu item's location in the menu.
|
@csMenuBreak (262144)
|
Causes a column break to occur at the specific item when used with drop-down, context, or submenus. Causes a line break (new row) with menu items hosted directly by the MENUBAR.
|
Note: Specifying 0 for this attribute is equivalent to using the DEFAULT keyword and means that the control will exhibit default behavior.
|
|
Context menu
MyDialog004=`000,000,000,000,MENUITEM,"mbi1_MyDialog",DEFAULT,"Job 1",DEFAULT,10,DEFAULT`
Attribute
|
Value
|
Meaning
|
dlg-variable
|
MyDialog
|
The name of the dialog box.
|
nn
|
004
|
The ordinal position of the control in the dialog box (starting with 1).
|
x
|
000
|
Not applicable to this control.
|
y
|
000
|
Not applicable to this control.
|
width
|
000
|
Not applicable to this control.
|
height
|
000
|
Not applicable to this control.
|
type
|
MENUITEM
|
The type of control.
|
control-name
|
"mbi1_MyDialog"
|
The name used to identify the control in a user defined callback procedure. The name cannot be more than 30 characters in length and MUST be unique. ( This attribute can only be used with 6.2 or later dialog formats. )
|
parent-name
|
DEFAULT
|
When you specify a MENUITEM this attribute is used to indicate the name of the control, menu bar, or MENUITEM that hosts this menu item. If you place the DEFAULT keyword in this attribute the item will be a menu item on the dialog's context menu. Likewise, placing the name of a control in this attribute will make the item a menu item of the named control's context menu. Placing the name of the MENUBAR control here will cause the item's text to be displayed in the dialog's menu bar. If you use the name of another MENUITEM, the menu item becomes a menu choice on either a dropdown in the case of top level MENUBAR items or a submenu displayed by the menu item named.
|
text
|
"Job 1"
|
The description which will be displayed with the control. [Use an empty string ("") if the control should appear blank.]
You can associate a shortcut key with a MENUITEM in this attribute by following the item's text with a back slash (\) and a key combination. The key combination is indicated by using the same key descriptions use with the SendKey function.
Note: Short-cut key combination should not be used with menu items that display dropdown menus or submenus. It is not considered good UI design and the menu caption may not display correctly.
|
value
|
DEFAULT
|
Not applicable to this control.
|
position
|
10
|
Indicates the display order of the control on a menu relative to other menu items on the same menu.
|
style
|
DEFAULT
|
Allows you to control the initial appearance and behavior of your control. Numbers represent each style and they can be combined, using the bit-wise OR (|) operator, to set multiple styles. The following table lists the style numbers, their meanings, and the controls that they have an effect on.
Style
|
Meaning
|
@csInvisible (1)
|
Control is invisible
|
@csDisabled (2)
|
Control has disabled appearance and does not accept any user input, it would otherwise accept input.
|
@csMenuCheck (32768)
|
Adds a check mark to the left of a menu item.
|
@csMenuRadio (65536)
|
Adds a radio button-like dot graphic to the left of a menu item.
|
@csMenuSep (131072)
|
Causes a separator bar graphic to display instead of text at the menu item's location in the menu.
|
@csMenuBreak (262144)
|
Causes a column break to occur at the specific item when used with drop-down, context, or submenus. Causes a line break (new row) with menu items hosted directly by the MENUBAR.
|
Note: Specifying 0 for this attribute is equivalent to using the DEFAULT keyword and means that the control will exhibit default behavior.
|
|
Event Options
Use the DialogProcOptions function to control when your User-Defined-Callback procedure is called by its associated dialog. You can also use it to control your dialog's behavior, while your procedure is executing. You usually establish callback events during the first call to the procedure i.e., event 0, but this can be done during any call.
Event-Option-Code Values
|
Meaning
|
@deMiSelect (15)
|
Menu Item Selection: the user has clicked a menu item using the mouse, has pressed a menu item's access key while its menu is displayed or the user has pressed a menu item's hot-key combination.
Note: The user-defined callback is not called in response to the selection of menu items via mouse or access key when the menu item has an associated dropdown or submenu. The associated dropdown or submenu is displayed instead.
|
@deMiInit (16)
|
Menu Item Initialization: The user has selected a dropdown menu, submenu or context menu. The name of the menu hosting control or menu item is passed to the user-defined callback as the value of its third parameter.
For example: This event be used to dynamically modify the menu itself.
|
|
|
Dialog Callback Procedure Function Options
DialogControlGet function returns text and state information associated with a control.
Request
|
Meaning
|
@dcMenuNames (18)
|
Tab delimited list of menu item names associated with the control, menu item or menu bar.
|
|
|
DialogControlSet function changes the text or appearance of a control.
Request
|
Meaning
|
|
Not applicable to this control.
|
|
|
DialogControlState function changes a control’s style or gives control input focus.
Style
|
Meaning
|
@csInvisible (1)
|
Control is invisible
|
@csDisabled (2)
|
Control has disabled appearance and does not accept any user input, it would otherwise accept input.
|
@csMenuCheck (32768)
|
Adds a check mark to the left of a menu item.
|
@csMenuRadio (65536)
|
Adds a radio button-like dot graphic to the left of a menu item.
|
@csMenuSep (131072)
|
Causes a separator bar graphic to display instead of text at the menu item's location in the menu.
|
@csMenuBreak (262144)
|
Causes a column break to occur at the specific item when used with drop-down, context, or submenus. Causes a line break (new row) with menu items hosted directly by the MENUBAR.
|
|
|
|
§ Dialog
§ Dialog Overview
§ Defining the Dialog
§ Defining the Dialog Controls
§ Dialog Control Types
§ Dynamic Dialogs
§ InternetExplorer Controls
§ Dialog Units
§ Dialog Fonts
Control Types
§ Calendar
§ Checkbox
§ ComControl
§ DropListbox
§ Editbox
§ FileListbox
§ Groupbox
§ Itembox
§ MenuBar
§ MenuItem
§ MultiLinebox
§ Picture
§ PictureButton
§ PushButton
§ RadioButton
§ ReportView
§ Spinner
§ StaticText
§ VaryText
|