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
Begin Dialog TextBoxSample 16,30,180,96,"Text Boxes and Text"
OKButton 132,20,40,14
CancelButton 132,44,40,14
Text 8,8,32,8,"Text Box:"
TextBox 8,20,100,12,.TextBox1
Text 8,44,84,8,"Multiline 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
Const ES_LEFT= &h0000&'Try these different styles OR-ed together
Const ES_CENTER= &h0001&' as the last parameter of Textbox the change
Const ES_RIGHT= &h0002&' the text box style.
Const ES_MULTILINE= &h0004&' A 1 in the last parameter position defaults to
Const ES_UPPERCASE= &h0008&' A multiline, Wantreturn, AutoVScroll testbox.
Const ES_LOWERCASE= &h0010&
Const ES_PASSWORD= &h0020&
Const ES_AUTOVSCROLL= &h0040&
Const ES_AUTOHSCROLL= &h0080&
Const ES_NOHIDESEL= &h0100&
Const ES_OEMCONVERT= &h0400&
Const ES_READONLY= &h0800&
Const ES_WANTRETURN= &h1000&
Const ES_NUMBER= &h2000&
Sub Multiline
Begin Dialog DialogType 60, 60, 140, 185, "Multiline text Dialog", .DlgFunc
TextBox 10, 10, 120, 150, .joe, ES_MULTILINE Or ES_AUTOVSCROLL Or ES_WANTRETURN' Indicates multiline TextBox
'TextBox 10, 10, 120, 150, .joe, 1 ' indicates multi-line textbox
CancelButton 25, 168, 40, 12
OKButton 75, 168, 40, 12
End Dialog
Dim Dlg1 As DialogType
Dlg1.joe= "The quick brown fox jumped over the lazy dog"
' Dialog returns -1 for OK, 0 for Cancel
button = Dialog( Dlg1 )
'MsgBox "button: " & button
If button = 0 Then Exit Sub
MsgBox "TextBox: "& Dlg1.joe
End Sub