Example:
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
End Dialog
Dim Dlg1 As TextBoxSample
Button = Dialog ( Dlg1 )
End Sub
The above code produces the following dialog:
Figure 4: Text boxes and text example
The following is an additional example of how to implement a multi-line text box:
'==========================================================
' This sample shows how to implement a Multi-line Text Box
'==========================================================
' Try these different styles or-ed together as the last
' parameter of the TextBox changes the text box style.
' A 1 in the last parameter position defaults to a Multiline,
' Wantreturn, AutoVScroll text box.
Const ES_LEFT = &h0000&
Const ES_CENTER = &h0001&
Const ES_RIGHT = &h0002&
Const ES_MULTILINE = &h0004&
Const ES_UPPERCASE = &h0008&
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 Multiline 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