Text

Syntax

Text HorizPos, VertPos, Width, Height, Label$ [, .Identifier]

Remarks

Creates a text label in a custom dialog box. If you want to use the text control to define an access key for a list box or text box, the Text instruction must precede the instruction for the list box or text box control.

Although you cannot type multiple-line text labels in the Dialog Editor, you can size a text label to hold more than one line and use a variable for Label$ that holds more than one line of text (use Chr$(13) to indicate a line break within a string).

Argument

Explanation

HorizPos, VertPos

The horizontal and vertical distance of the upper-left corner of the text control rectangle from the upper-left corner of the dialog box, in increments of 1/8 and 1/12 of the System font (Windows) or the dialog font (Macintosh).

Width, Height

The width and height of the rectangle, in increments of 1/8 and 1/12 of the System font (Windows) or the dialog font (Macintosh).

Label$

The label to display in the dialog box. An ampersand (&) precedes the character in Label$ that is the access key for the control following the Text instruction. If Label$ is longer than 255 characters, an error occurs.

.Identifier

An optional identifier used by statements in a dialog function that act on the text control. For example, you can use this identifier with DlgText to change Label$ while the dialog box is displayed.


Examples

In this example, the Text instruction results in the label "Sample Text," which indicates that "S" is the access key for the text box defined in the next instruction.


Begin Dialog UserDialog 320, 84, "Sample Dialog Macro"
Text 10, 6, 160, 12, "&Sample Text", .myTextControl
TextBox 10, 21, 236, 18, .TextBox1
OKButton 9, 58, 88, 21
CancelButton 115, 58, 88, 21
End Dialog

The following example displays the first 255 characters of the current selection in the text label.


textlabel$ = Left$(Selection$(), 255)
Begin Dialog UserDialog 621, 251, "Show Selection Text"
    OKButton 409, 220, 88, 21
    CancelButton 509, 220, 88, 21
    Text 10, 6, 586, 203, textlabel$, .Text1
End Dialog

See Also

Begin Dialog¼End Dialog, TextBox