Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Listbox, select item on ENTER or SPACE?
#1
Is it possible to let a user select an item from an listbox on ENTER or SPACE?
In the below the focus is put on the listbox, but is it possible to select an item on ENTER or SPACE?

Function test_lb
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 ListBox 0x54230101 0x200 11 7 88 63 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040301 "*" "" "" ""

str controls = "3"
str lb3
lb3="test 1[]test 2[]test 3"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret

#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG        
,,int w=win("Dialog" "#32770")
,,act id(3 w) ;;list        
,,int- lbox_3=id(3 hDlg)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,;; case , user presses SPACE or ENTER on selection
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)