PUSHBUTTON

PUSHBUTTON text, id, x, y, width, height, [style]

The PUSHBUTTON statement creates a push-button control. The control is a round-cornered rectangle containing the given text. The control sends a message to its parent whenever the user chooses the control.

Parameters

text

Specifies text that is centered in the rectangular area of the control. This parameter 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. An ampersand (&) character character in the text indicates that the following character is used as a mnemonic character for the control. When the control is displayed, the ampersand 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.

id

Specifies the control identifier. This value must be an integer in the range 0 through 65,535 or an expression consisting of integers and the additon (+) operator that evaluates to a value in that range.

x

Specifies the x-coordinate of the upper-left corner of the control. This value must be an integer in the range 0 through 65,535 or an expression consisting of integers and the addition (+) operator that evaluates to a value in that range. The coordinate is assumed to be in dialog units and is relative to the origin of the dialog box containing the pushbutton.

y

Specifies the y-coordinate of the upper-left corner of the control. This value must be an integer in the range 0 through 65,535 or an expression consisting of integers and the addition (+) operator that evaluates to a value in that range. The coordinate is assumed to be in dialog units and is relative to the origin of the dialog box containing the pushbutton.

width

Specifies the width of the control. This value must be an integer in the range 1 through 65,535 or an expression consisting of integers and the addition (+) operator that evaluates to a value in that range. The width units are 1/4 of the dialog base width unit.

height

Specifies the height of the control. This value must be an integer in the range 1 through 65,535 or an expression consisting of integers and the addition (+) operator that evaluates to a value in that range. The height units are 1/8 of the dialog base height unit.

style

This optional parameter specifies styles for the pushbutton, which can be a combination of the BS_PUSHBUTTON style and the following styles: WS_DISABLED, WS_GROUP, and WS_TABSTOP.

Comments

The current dialog base units are computed from the height and width of the current system font. The GetDialogBaseUnits function returns the dialog base units in pixels. The coordinates are relative to the origin of the dialog box.

The default style for PUSHBUTTON is BS_PUSHBUTTON and WS_TABSTOP.

Examples

The following example demonstrates the usage of the PUSHBUTTON statement:

PUSHBUTTON "ON", 7, 10, 10, 20, 10

See Also

GetDialogBaseUnits