CONST False = 0
CONST True = NOT False
DECLARE SUB ButtonClick
CREATE Form AS QFORM
Height = 290
Width = 350
CAPTION = "Multi-Select ListBox"
Center
CREATE ListBox1 AS QLISTBOX
MultiSelect = True
Width = 150
Height = 200
AddItems "Item 1", "Item 2", "Item 3", "Item 4", _
"Item 5", "Item 6", "Item 7", "Item 8", "Item 9"
END CREATE
CREATE ListBox2 AS QLISTBOX
Left = 190
Width = 150
Height = 200
END CREATE
CREATE Button AS QCOOLBTN
Left = 155
Top = 50
Width = 30
CAPTION = ">"
OnClick = ButtonClick
END CREATE
CREATE Label AS QLABEL
Left = 10
Top = 220
CAPTION = "To multiselect individual items, " + _
"just hold down the CTRL key" + CHR$(13) + _
"while pressing the mouse button."
END CREATE
SHOWMODAL
END CREATE
SUB ButtonClick
ListBox2.Clear
FOR I = 0 TO ListBox1.ItemCount-1
IF ListBox1.Selected(I) THEN
ListBox2.AddItems ListBox1.Item(I)
END IF
NEXT
END SUB
|