TextBox

Syntax

TextBox HorizPos, VertPos, Width, Height, .Identifier[$] [MultiLine]

Remarks

Creates a single-line or multiple-line text box into which the user can enter information in a custom dialog box. You can insert as many as 255 characters into a text box control.

Argument

Explanation

HorizPos, VertPos

The horizontal and vertical distance of the upper-left corner of the text box 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 text box, in increments of 1/8 and 1/12 of the System font (Windows) or the dialog font (Macintosh).

.Identifier[$]

Together with the dialog record name, .Identifier[$] creates a variable whose value corresponds to the text in the text box. The form for this variable is DialogRecord.Identifier[$] (for example, dlg.MyTextBox$). The dollar sign ($) is optional; you can use it to indicate that the variable is a string variable.

The identifier string (.Identifier[$] minus the period) is also used by statements in a dialog function that act on the text box, such as DlgEnable and DlgVisible.

MultiLine

Specifies whether the text box is a single-line or multiple-line text box:

0 (zero) Single-line text box

1 Multiple-line text box

In a multiple-line text box, the user can press ENTER or SHIFT+ENTER to begin new lines when typing text into the box. Note that multiple-line text boxes do not contain scroll bars; however, the user may scroll through text using the arrow keys. If the user presses ENTER or SHIFT+ENTER to begin a new line, the string returned by the identifier will contain a paragraph mark.


Example

In this example, text entered in the multiple-line text box created with the TextBox instruction is stored in the dlg.TextBox1 variable:


Begin Dialog UserDialog 290, 152, "Sample Dialog Macro"
Text 10, 6, 260, 12, "&Sample Text: Press ENTER"
Text 10, 22, 143, 12, "to start a new line."
TextBox 10, 43, 236, 64, .TextBox1, 1
OKButton 10, 117, 88, 21
CancelButton 117, 117, 88, 21
End Dialog
Dim dlg As UserDialog
Dialog dlg

See Also

Begin Dialog¼End Dialog, Text