Syntax
DlgListBoxArray Identifier[$], ArrayVariable$()
DlgListBoxArray(Identifier[$] [, ArrayVariable$()])
Remarks
The DlgListBoxArray statement is used within a dialog function to fill a list box, drop-down list box, or combo box with the contents of ArrayVariable$(). You can use this statement to change the contents of a list box, drop-down list box, or combo box in a custom dialog box while the dialog box is displayed.
For information about using a dialog function, see Chapter 5, "Working with Custom Dialog Boxes," in Part 1, "Learning WordBasic."
Argument | Explanation |
Identifier[$] | The string or numeric identifier of the dialog box control. The control must be a list box, drop-down list box, or combo box. |
ArrayVariable$() | A string array containing items to be displayed in the specified list box, drop-down list box, or combo box. |
The DlgListBoxArray() function fills ArrayVariable$() with the contents of the list box, drop-down list box, or combo box specified by Identifier[$] and returns the number of entries in the list box, drop-down list box, or combo box. ArrayVariable$() is optional with the DlgListBoxArray() function; if ArrayVariable$() is omitted, DlgListBoxArray() returns the number of entries
in the specified control.
Example
This example changes the contents of a list box while the dialog box is displayed. The dialog box definition in the main subroutine (not shown) defines a dialog box containing a list box, the OK and Cancel buttons, and a Change button. When the user chooses the Change button, the If control structure in Case 2 of the dialog function takes over: A new string array is defined, DlgListBoxArray is used to replace the contents of the list box, and the Change button is disabled. By default, a custom dialog box is closed when the user chooses a command button such
as the Change button; however, in this example, the keepDisplayed = 1 and dlgTest = keepDisplayed instructions keep the dialog box displayed (when
a dialog function returns a value of 1, the dialog box remains displayed).
Function dlgTest(identifier$, action, suppvalue) Select Case action Case 1 'The dialog box is displayed Case 2 'The user selects a control If identifier$ = "Change" Then Dim MyArray2$(1) MyArray2$(0) = "New first item" MyArray2$(1) = "New second item" DlgListBoxArray "MyListBox", MyArray2$() DlgFocus "MyListBox" DlgEnable "Change", 0 keepDisplayed = 1 End If Case 3 'Text change (not applicable) Case Else End Select dlgTest = keepDisplayed End Function
See Also
DlgEnable, DlgFocus, DlgText