Syntax
|
DlgListBoxArray
({ControlName$ | ControlIndex}, ArrayVariable)
|
Description
|
Fills a list box, combo box, or drop list box with the elements of an array, returning an
Integer
containing the number of elements that were actually set into the control.
|
Comments
|
The ControlName$ parameter contains the name of the .Identifier parameter associated with a control in the dialog box template. A case-insensitive comparison is used to locate the specific control within the template. Alternatively, by specifying the ControlIndex parameter, a control can be referred to using its index in the dialog box template (0 is the first control in the template, 1 is the second, and so on).
|
|
The ArrayVariable parameter specifies a single-dimensioned array used to initialize the elements of the control. If this array has no dimensions, then the control will be initialized with no elements. A runtime error results if the specified array contains more than one dimension. ArrayVariable can specify an array of any fundamental data type (structures are not allowed).
Null
and
Empty
values are treated as zero-length strings.
|
Example
|
This dialog function refills an array with files.
Function DlgProc(ControlName$,Action%,SuppValue%) As Integer
If Action% = 1 Then
Dim NewFiles$() 'Create a new dynamic array.
FileList NewFiles$,"c:\*.*" 'Fill the array with files.
r% = DlgListBoxArray("Files",NewFiles$) 'Set items in the list box.
DlgValue "Files",0 'Set the selection to the first item.
DlgProc = 1 'Don't close the dialog box.
End If
End Function
|
|
Sub Main()
Dim ListBox1$()
Begin Dialog UserDialog ,,180,96,"Untitled",.DlgProc
OKButton 132,8,40,14
CancelButton 132,28,40,14
ListBox 8,12,112,72,ListBox1$,.Files
End Dialog
Dim d As UserDialog
Dialog d
End Sub
|
See Also
|
DlgEnable (function); DlgEnable (statement); DlgFocus (function); DlgFocus (statement); DlgListBoxArray (statement); DlgSetPicture (statement); DlgText (statement); DlgText$ (function); DlgValue (function); DlgValue (statement); DlgVisible (statement); DlgVisible (function).
|