8.2. Enter Information into the Custom Dialog Box

If you open and run the sample script shown in the preceding subsection, you will see a dialog box that resembles the following.

Controls to which values can be assigned.

Define and fill an array.

Set default text in a text box.

Set the initial focus and controlling the tabbing order.

Controls to which Values can be Assigned

This custom dialog box is not very useful. For one thing, the user doesn't see any items in the list box along the left side of the dialog box. To put information into this dialog box, you assign values to its controls by modifying the statements in your script that are responsible for displaying those controls to the user. The following table lists the dialog box controls to which you can assign values and the types of information you can control:

Control(s)

Types of Information

List box, drop list box, and combo box

Items

Text box

Default text

Check box

Values

Define and Fill an Array

You can store items in the list box shown in the example above by creating an array and then assigning values to the elements of the array. For example, you could include the following lines to initialize an array with three elements and assign the names of three common fruits to these elements of your array:

Dim ListBox1$(3)     'Initialize list box array.

ListBox1$(0) = "Apples"
ListBox1$(1) = "Oranges"
ListBox1$(2) = "Pears"

Set Default Text in a Text Box

You can set the default value of the text box in your script to 12 with the following statement, which must follow the statement that defines the dialog record but precede the statement or function that displays the custom dialog box:

b.TextBox1 = "12"

Set the Initial Focus and Controlling the Tabbing Order

You can determine which control has the focus when your custom dialog box is first displayed as well as the tabbing order between controls by understanding two rules that the Basic Control Engine script follows. First, the focus in a custom dialog box is always set initially to the first control to appear in the dialog box template. Second, the order in which subsequent controls appear within the dialog box template determines the tabbing order. That is, pressing the Tab key will change the focus from the first control to the second one, pressing the Tab key again will change the focus to the third control, and so on.

More information

8. Use a custom dialog box in a script.