After displaying a custom dialog box for your user, your script must retrieve the values of the dialog controls. You retrieve these values by referencing the appropriate identifiers in the dialog record.
You'll find an example of how to retrieve values from a custom dialog box in the following subsection.
In the following sample script several of the techniques described earlier in this section have been used.
In this script, the array named ListBox1 is filled with three elements ("Apples", "Oranges", and "Pears"). The default value of TextBox1 is set to 12. A variable named response is used to store information about how the custom dialog box was closed. An identifier named ListBox1 is used to determine whether the user chose "Apples", "Oranges", or "Pears" in the list box named ListBox$. Finally, a Select Case . . . End Select statement is used to display a message box appropriate to the manner in which the user dismissed the dialog box.
Dim ListBox1$(2) 'Initialize list box array.
ListBox1$(0) = "Apples"
ListBox1$(1) = "Oranges"
ListBox1$(2) = "Pears"
Begin Dialog UserDialog ,,163,94,"Grocery
Text 13,6,32,8,"&Quantity:",.Text1 'First control in
'template gets the focus.
Dim b As UserDialog 'Create
the dialog record.
b.TextBox1 = "12" 'Set default value of the text box
'to 1 dozen.
response = Dialog(b) 'Display the dialog box.
Select Case response%
Fruit$ = ListBox1$(b.ListBox1)
MsgBox "Thank you for ordering " + b.TextBox1 + " " + Fruit$ + "."
MsgBox "Your order has been canceled."
8. Use a custom dialog box in a script.