Purpose |
Add an auto 3-state checkbox to a dialog. This is commonly used to indicate a selection that may be True (set or checked), False (unset or cleared) or Indeterminate (grayed), and is often found in dialogs that provide "multiple choice" options. | ||||||||||||||||||||||||||||
Syntax |
CONTROL ADD CHECK3STATE, hDlg, id&, txt$, x, y, xx, yy [, [style&] [, [exstyle&]]] [[,] CALL callback] | ||||||||||||||||||||||||||||
hDlg |
Handle of the dialog in which the 3-state checkbox will be created. The dialog will become the parent of the control. | ||||||||||||||||||||||||||||
id& |
Unique identifier for the control in the range 1 to 65535, frequently specified with numeric equates for clarity of the code. For example, the %AutoLogoff equate is more informative than a literal value such as 497. Best practice suggests identifiers should start at 100 to avoid conflict with any of the standard predefined identifiers. | ||||||||||||||||||||||||||||
txt$ |
Text to be displayed in the 3-state checkbox. An ampersand (&) may be included in txt$ to specify a hot-key. See the Remarks section below. | ||||||||||||||||||||||||||||
x, y |
| ||||||||||||||||||||||||||||
xx |
Integer expression, variable, or numeric literal value, specifying the width of the control. The width is given in the same terms (pixels or dialog units) as the parent dialog. The most common value used in the Microsoft Dialog Editor and Visual Studio is 40 dialog units. | ||||||||||||||||||||||||||||
yy |
Integer expression, variable, or numeric literal value, specifying the height of the control. The height is given in the same terms (pixels or dialog units) as the parent dialog. The most common value used in the Microsoft Dialog Editor and Visual Studio is 14 dialog units. | ||||||||||||||||||||||||||||
style& |
Primary style of the 3-state checkbox control. The default 3-state checkbox style comprises %BS_LEFT, %BS_VCENTER, and %WS_TABSTOP. The default style is used only if both the primary and extended style parameters are omitted from the statement. For example: CONTROL ADD CHECK3STATE, hDlg, id&, txt$, 100, 100, 40, 14, , , _ CALL Check3Callback() ' Use default styles Custom style values replace the default values. That is, they are not additional to the default style values - your code must specify all necessary primary and extended style parameters. The primary 3-state checkbox style value can be a combination of any values below, combined together with the OR operator to form a bitmask:
| ||||||||||||||||||||||||||||
exstyle& |
Extended style of the 3-state checkbox control. The default extended 3-state checkbox style comprises %WS_EX_LEFT. The default extended style is used if both the primary and extended style parameters are omitted from the CONTROL ADD CHECK3STATE statement, in the same manner as style& above. The extended 3-state checkbox style value can be a combination of any values below, combined together with the OR operator to form a bitmask:
| ||||||||||||||||||||||||||||
callback |
Optional name of a Callback Function will receive all %WM_COMMAND notification messages for the control. If a callback for the control is not designated, you must create a Callback Function for the dialog to process notification messages from your 3-state checkbox. In general, if the control Callback Function processes a message, it should return TRUE (non-zero) to prevent the message being passed unnecessarily to the dialog callback (if one exists). The dialog callback should also return TRUE if the notification message is processed by that Callback Function. Otherwise, the DDT engine processes unhandled messages. | ||||||||||||||||||||||||||||
Remarks |
If the ampersand (&) character appears in the txt$ parameter, the letter that follows will be displayed underscored. This adds a control accelerator (hot-key) to enable the user to directly "click" a control, simply by pressing and holding the ALT key while pressing the specified hot-key. For example, "Set s&tate" makes ALT+t the hot-key. When the user clicks a 3-state checkbox, a message is sent to the Callback Function designated for the control. If there is no Callback Function designated, the message is sent to the callback for the dialog. If the control callback processes the notification message, it should return TRUE (non-zero) to prevent the message being passed needlessly to the dialog callback, and eventually to the DDT engine itself. Notification messages are sent to the Callback Function, with CBMSG = %WM_COMMAND, CBCTL holding the ID (id&) of the control, and CBCTLMSG holding the following values:
When a Callback Function receives a %WM_COMMAND message, it should explicitly test the value of CBCTL and CBCTLMSG to guarantee it is responding appropriately to the notification message. | ||||||||||||||||||||||||||||
See also |
Dynamic Dialog Tools, CONTROL ADD CHECKBOX, CONTROL ADD OPTION, CONTROL GET CHECK, CONTROL SET CHECK |