Text Boxes and Text

A text box control is a box in which the user can enter text while the dialog box is displayed. By default, a text box holds a single line of text. Enable support single and multiline text boxes. The last parameter of the textbox function contains a variable to set the textbox style.

Sub Main

MsgBox "This example displays a dialog box that shows the difference between a single-line text box and a multi-line text box"

Begin Dialog TextBoxSample 16,30,180,96,"Text Boxes and Text"

OKButton 125,74,40,14

Text 8,8,32,8,"Single-line Text Box:"

TextBox 8,20,100,12,.TextBox1

Text 8,44,84,8,"Multi-line Text Box:"

TextBox 8,56,100,32,.TextBox2, 1

End Dialog

Dim Dlg1 As TextBoxSample

Button = Dialog ( Dlg1 )

End Sub

 

Example Code: How to implement a multiline textbox

Sub Main

Begin Dialog DialogType 60, 60, 140, 185, "Multiline Text Dialog"

TextBox 10, 10, 120, 150, .Textbox1

CancelButton 25, 168, 40, 12

OKButton 75, 168, 40, 12

End Dialog

 

Dim Dlg1 As DialogType

Dlg1.Textbox1 = "The quick brown fox jumped over the lazy dog"

 

' Dialog returns -1 For OK, 0 For Cancel

Button = Dialog( Dlg1 )

 

If Button = 0 Then Exit Sub

MsgBox "TextBox: "& Dlg1.Textbox1

End Sub