CTEXT Statement

Summary: Syntax

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

This statement defines a centered text control. It creates a simple rectangle that displays the given text centered in the rectangle. The text is formatted before it is displayed. Words that would extend past the end of a line are automatically wrapped to the beginning of the next line.

The text field takes an ASCII string that specifies the text to be displayed. The string must be enclosed in double quotation marks. To add a mnemonic to the text string, place an ampersand (&) ahead of the letter that will be the mnemonic. To use an ampersand as a character in a string, insert two ampersands (&&).

The id field takes a unique integer value that identifies the control.

The x and y fields take integer values that specify the x and y coordinates of the upper-left corner of the control. The horizontal units are 1/4 of the dialog base width unit; the vertical units are 1/8 of the dialog base height unit. 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 width and height fields take integer values that specify the width and height of the control. The width units are 1/4 of the dialog base width unit; the height units are 1/8 of the dialog base height unit.

The optional style field can contain any combination (or none) of the following styles:

WS_TABSTOP

WS_GROUP

These styles are described in the list of window styles following the description of the STYLE statement on page 171. Styles can be combined using the bitwise inclusive OR operator.

Summary: Comments

The x, y, width, and height fields can use the addition operator (+) for relative positioning. For example, 15 + 6 can be used for the x field.

The default style for CTEXT is SS_CENTER and WS_GROUP.

The following example demonstrates the correct usage of the CTEXT statement:

CTEXT “Title”, 3, 10, 50, 40, 10