<< Click to Display Table of Contents >> List boxes, combo boxes and drop-down lists |
List boxes show lists from which the user can select an option.
There are three types of list boxes:
▪Standard list boxes
Here, the user can choose one of the options from the list.
▪Combo boxes
Here, the user can either choose from a list of entries or manually enter his or her own input.
▪Drop-down list boxes
A space saving version of list boxes: The user must open it up before being able to choose an option.
Syntax:
ListBox X, Y, Width, Height, Content, .ID
ComboBox X, Y, Width, Height, Content, .ID
DropListBox X, Y, Width, Height, Content, .ID
The individual text entries are set through the string array Content which you need to fill before displaying the dialog.
ID is a variable that contains the currently selected item: For ListBox and DropListBox this is a number (the index), for ComboBox it is text.
Example:
Sub Main
Dim MyList$(5)
MyList(0) = "List Entry 1"
MyList(1) = "List Entry 2"
MyList(2) = "List Entry 3"
MyList(3) = "List Entry 4"
MyList(4) = "List Entry 5"
MyList(5) = "List Entry 6"
Begin Dialog BoxSample 16,35,256,89,"List box, combo box and drop-down list"
OKButton 204, 24, 40, 14
CancelButton 204, 44, 40, 14
ListBox 12, 24, 48, 40, MyList$(), .Lstbox
DropListBox 124, 24, 72, 40, MyList$(), .DrpList
ComboBox 68, 24, 48, 40, MyList$(), .CmboBox
Text 12, 12, 32, 8, "List box:"
Text 124, 12, 68, 8, "Drop-down list:"
Text 68, 12, 44, 8, "Combo box:"
End Dialog
Dim Dlg1 As BoxSample
Dlg1.Lstbox = 0
Dlg1.CmboBox = "List entry 2"
Dlg1.DrpList = 2
rc% = Dialog(Dlg1)
End Sub