CONTROL Statement
Syntax:
CONTROL text, id, x, y, width, height, class[, style]
[data-definitions]
[ BEGIN
control-definition
.
.
.
END ]
The CONTROL statement defines a control as belonging to the specified class.
The statement defines the position and dimensions of the control within
the parent window, as well as the control style. The CONTROL statement
is most often used in a DIALOG or WINDOW statement.
Typically, several CONTROL statements are used in each DIALOG statement,
and each CONTROL statement must have a unique identifier value. The optional
BEGIN and END statements enclose any CONTROL statements that may be given
with the control. CONTROL statements given in this manner represent child
windows belonging to the control created by the CONTROL statement.
text
Specifies text that is displayed to the right
of the control. This field must contain zero or more characters enclosed
in double quotation marks. Character values must be in the range 1 through
255. If a double quotation mark is required in the text, you must include
the double quotation mark twice. In the appropriate styles, a tilde ( ~
) character in the text indicates that the following character is used as
a mnemonic character for the control. When the control is displayed, the
tilde is not shown, but the mnemonic character is underlined. The user
can choose the control by pressing the key corresponding to the underlined
mnemonic character.
When the style field for this control includes the style SS_BITMAP, the
text field should be written as a number equal to the resource identifier
of the bitmap to be loaded.
id
Specifies
the control identifier. This value must be a signed integer in the range
-32768 through 32767, an unsigned integer in the range of 1 through 65535,
or a simple expression that evaluates to a value in these ranges.
x
Specifies the x-coordinate of the lower-left corner
of the control. This value must be a signed integer in the range -32768
through 32767 or an expression consisting of integers and the addition (+)
or subtraction (-) operator. The coordinate is assumed to be in dialog
units and is relative to the origin of the parent window.
y
Specifies the y-coordinate of the lower-left corner
of the control. This value must be a signed integer in the range -32768
through 32767 or an expression consisting of integers and the addition (+)
or subtraction (-) operator. The coordinate is assumed to be in dialog
units and is relative to the origin of the parent window.
width
Specifies the width of the control. This value
must be an integer in the range 0 through 65535 or an expression consisting
of integers and the addition (+) or subtraction (-) operator. The value
is in n-character units.
height
Specifies
the height of the control. This value must be an integer in the range 0
through 65535 or an expression consisting of integers and the addition (+)
or subtraction (-) operator. The value is in 1/8-character units.
class
Specifies the control class. This value can be
one of the control classes specified in the "Control Classes" table, in
the Presentation Manager Programming Reference, or the name of the control
class, enclosed in double quotation marks.
style
Specifies the control style. This value can be
a combination of control styles. You can use the bitwise OR (|) operator
to combine styles.
data-definitions
Specifies
a CTLDATA and/or PRESPARAMS statement. These statements define control and
presentation data for the control. For more information, see CTLDATA
Statement and PRESPARAMS Statement.
control-definition
Specifies
a CONTROL statement or any one of several predefined control statements.
These statements define the style, position, and dimensions of controls
in the control.
Comments
The CONTROL statement can actually contain any combination of CONTROL, DIALOG,
and WINDOW statements. But typically, a CONTROL statement contains no such
statements.
Example
This example creates a pushbutton control with the WS_TABSTOP and WS_VISIBLE
styles.
CONTROL "OK", 101, 10, 10, 20, 50, WC_BUTTON, BS_PUSHBUTTON | WS_TABSTOP |
WS_VISIBLE
[Back: CONTAINER Statement]
[Next: CTEXT Statement]