DropListBox Dialog Item Definition

Syntax:

DropListBox X, Y, DX, DY, StrArray$( ), .Field[, Options]

Group: User Dialog

Description:
Define a drop-down listbox item.

Parameter Description

X This number value is the distance from the left edge of the dialog box. It is measured in 1/8 ths of the average character width for the dialog's font.

Y This number value is the distance from the top edge of the dialog box. It is measured in 1/12 ths of the character height for the dialog's font.

DX This number value is the width. It is measured in 1/8 ths of the average character width for the dialog's font.

DY This number value is the height. It is measured in 1/12 ths of the character height for the dialog's font.

StrArray$( ) This one-dimensional array of strings establishes the list of choices. All the non-null elements of the array are used.

Field The value of the drop-down list box is accessed via this field. It is the index of the StrArray$( ) var.

Options This numeric value controls the type of drop-down list box. Choose one value from following table. (If this numeric value omitted then zero is used.)

Option

Description

0

Text box is not editable and list is not sorted.

1

Text box is editable and list is not sorted.

2

Text box is not editable and list is sorted

3

Text box is editable and list is sorted.

 See Also: Begin Dialog, Dim As UserDialog.

Example:

Sub Main
  Dim lists$(3)
  lists$(0) = "List 0"
  lists$(1) = "List 1"
  lists$(2) = "List 2"
  lists$(3) = "List 3"
  Begin Dialog UserDialog 200,120
  Text 10,10,180,15,"Please push the OK button"
  DropListBox 10,25,180,60,lists$(),.list1
  DropListBox 10,50,180,60,lists$(),.list2,1
  OKButton 80,90,40,20
  End Dialog
  Dim dlg As UserDialog
  dlg.list1 = 2 ' list1 is a numeric field
  dlg.list2 = "xxx" ' list2 is a string field
  Dialog dlg ' show dialog (wait for ok)
  Debug.Print lists$(dlg.list1)
  Debug.Print dlg.list2
End
Sub