TextBox (statement)


TextBox x,y,width,height,.Identifier [,[isMultiline] [,[FontName$] [,[size] [,style]]]]


Defines a single or multiline text-entry field within a dialog box template.


If isMultiline is 1, the TextBox statement creates a multiline text-entry field. When the user types into a multiline field, pressing the Enter key creates a new line rather than selecting the default button.

This statement can only appear within a dialog box template (that is, between the Begin Dialog and End Dialog statements).

The TextBox statement requires the following parameters:





x, y

Integer position of the control (in dialog units) relative to the upper left corner of the dialog box.


width, height

Integer dimensions of the control in dialog units.



Name by which this control can be referenced by statements in a dialog function (such as DlgFocus and DlgEnable). This parameter also creates a string variable whose value corresponds to the content of the text box. This variable can be accessed using the syntax:




Specifies whether the text box can contain more than a single line (0 = single-line; 1 = multiline).



Name of the font used for display of the text within the text box control. If omitted, then the default font for the dialog is used.



Size of the font used for display of the text within the text box control. If omitted, then the default size for the default font of the dialog is used.



Style of the font used for display of the text within the text box control. This can be any of the following values:




Normal font (i.e., neither bold nor italic)




Bold font




Italic font




Bold-italic font



If omitted, then ebRegular is used.


When the dialog box is created, the Identifier variable is used to set the initial content of the text box. When the dialog box is dismissed, the variable will contain the new content of the text box.

A single-line text box can contain up to 256 characters. The length of text in a multiline text box is not limited by the Basic Control Engine; the default memory limit specified by the given platform is used instead.


Sub Main()
  Begin Dialog UserDialog 81,64,128,60,"Untitled"
    CancelButton 80,32,40,14
    OKButton 80,8,40,14
    TextBox 4,8,68,44,.TextBox1,1
  End Dialog
  Dim d As UserDialog
  d.TextBox1 = "Enter text before invoking" 'Display text in the Textbox by setting the default value of the TextBox before showing it.
  Dialog d
End Sub

See Also

CancelButton (statement); CheckBox (statement); ComboBox (statement); Dialog (function); Dialog (statement); DropListBox (statement); GroupBox (statement); ListBox (statement); OKButton (statement); OptionButton (statement); OptionGroup (statement); Picture (statement); PushButton (statement); Text (statement); Begin Dialog (statement), PictureButton (statement).


8-point MS Sans Serif is the default font used within user dialogs.

More information