Listbox problem
BlitzPlus Forums/BlitzPlus Programming/Listbox problem
| ||
| Hi, i have an problem with listbox to... When scroll with cousor-buttons to and push return or enter to, how can check it do? With textfield can check the key's to, with EventData(), but listbox returned only this position of selected item...
window = CreateWindow("test",0,0,600,400,Desktop(),1+4+8)
canvas = CreateCanvas(10,10,200,230,window)
textfield = CreateTextField(250,10,200,16,window)
textarea = CreateTextArea(250,40,200,95,window)
listbox = CreateListBox(250,145,200,95,window)
For i=0 To 20
AddGadgetItem listbox, Chr$(Rand(65,90)) +Chr$(Rand(65,90)) +Chr$(Rand(65,90)) +Chr$(Rand(65,90))
Next
While WaitEvent()
; running only it isn't selected gadget
If KeyHit(158) Or KeyHit(28) Then DebugLog "ENTER/RETURN"
Select EventID()
Case $803
End
Case $101 ; KEYDOWN
DebugLog EventData()
Case $401 ; GADGET
Select EventSource()
Case listbox ; only position of selected item
SetStatusText window, "401 LISTBOX "+ EventData()
Case textarea ; no output
SetStatusText window, "401 TEXTAREA "+ EventData()
Case textfield ; all key's are ASCII-Code
SetStatusText window, "401 TEXTFIELD "+ EventData()
Case canvas ; no output
SetStatusText window, "401 CANVAS "+ EventData()
Default
;
End Select
Default
;
End Select
Wend
|