Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Looking for a Dialog Example with Interactive List Filtering
#4
Hi Gintaras
I tinkered with your example to display all items when the edit box is empty and to work out which item is clicked.
I would now like get messages when a key is pressed so I can changed the selected item with the up and down arrow keys (without pressing tab first), leaving the typing focus in the edit box (like the Gmail / Compose Mail / To: drop down list that lets you either keep typing or select from the list with the arrow keys).
Thanks for your help,
John


\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str- sItems=
;January
;February
;March
;April
;May

str controls = "3 4"
str e3 lb4
if(!ShowDialog("dlg_list_filtering" &dlg_list_filtering &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;3 Edit 0x54030080 0x200 0 0 96 14 ""
;4 ListBox 0x54230101 0x200 0 16 96 102 ""
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x203000E "*" "" ""

ret
;messages
int hlb=id(4 hDlg)
str s
int- c
if(message=WM_SETCURSOR) ret
c+1
out "in message: %i %x %x" c message WM_SETCURSOR
sel message
,case WM_INITDIALOG
,,foreach s sItems
,,,LB_Add hlb s
,,LB_SelectItem hlb 0
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_CTLCOLORLISTBOX
,,int pos=LB_SelectedItem(hlb s)
,,out "Mouse item=%i %s" pos s
,case WM_TIMER
,out "in message2: %i %i" c message
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,hlb=id(4 hDlg)
,,SendMessage hlb LB_RESETCONTENT 0 0
,,str sEdit.getwintext(id(3 hDlg))
,,;if(!sEdit.len) ret
,,foreach s sItems
,,,if(sEdit.len>0 && find(s sEdit 0 1)<0) continue
,,,LB_Add hlb s
,,LB_SelectItem hlb 0
ret
;messages2
sel wParam
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 100 0
,case IDOK
,case IDCANCEL
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)