06-01-2009, 05:21 AM
Key messages are sent to focused control. Dialog does not receive them. To get messages sent to a control, subclass the control.
Function dlg_list_filtering
(changed only WM_INITDIALOG and WM_DESTROY code)
Function MyEditSubclassProc
Function dlg_list_filtering
\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
sel message
,case WM_INITDIALOG
,int he=id(3 hDlg)
,SetProp he "wndproc" SubclassWindow(he &MyEditSubclassProc)
,
,case WM_DESTROY
,RemoveProp he "wndproc"
,
,case WM_COMMAND goto messages2
,case WM_TIMER
,sel wParam
,,case 1
,,KillTimer hDlg wParam
,,int hlb=id(4 hDlg)
,,SendMessage hlb LB_RESETCONTENT 0 0
,,str s sEdit.getwintext(id(3 hDlg))
,,if(!sEdit.len) ret
,,foreach s sItems
,,,if(find(s sEdit 0 1)<0) continue
,,,LB_Add hlb s
ret
;messages2
sel wParam
,case EN_CHANGE<<16|3
,SetTimer hDlg 1 300 0
,case IDOK
,case IDCANCEL
ret 1(changed only WM_INITDIALOG and WM_DESTROY code)
Function MyEditSubclassProc
;/
function# hWnd message wParam lParam
;__OutWinMsg message wParam lParam
sel message
,case WM_DESTROY
,case [WM_KEYDOWN,WM_KEYUP]
,sel wParam ;;virtual key code
,,case [VK_DOWN,VK_UP,VK_PRIOR,VK_NEXT]
,,;relay these keys to the listbox and not to the edit box
,,SendMessage id(4 GetParent(hWnd)) message wParam lParam
,,ret
int wndproc=GetProp(hWnd "wndproc"); if(!wndproc) ret
ret CallWindowProcW(wndproc hWnd message wParam lParam)