From c617e0de6b14ff2ff606f44b846d5cc29fc1e731 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 14 Apr 2000 22:38:51 +0000 Subject: [PATCH] send key up/down events too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7169 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/combobox.cpp | 90 +++++++++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 34 deletions(-) diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index c50ea3126a..aa1bf0c8bd 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -80,45 +80,60 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, WPARAM wParam, LPARAM lParam) { - if ( - message == WM_CHAR -#if wxUSE_TOOLTIPS - || message == WM_NOTIFY -#endif // wxUSE_TOOLTIPS - ) - { - HWND hwndCombo = ::GetParent(hWnd); - wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo); - wxComboBox *combo = wxDynamicCast(win, wxComboBox); - wxCHECK_MSG( combo, 0, _T("should have combo as parent") ); + HWND hwndCombo = ::GetParent(hWnd); + wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo); + + switch ( message ) + { + // forward some messages to the combobox + case WM_KEYUP: + case WM_KEYDOWN: + case WM_CHAR: + { + wxComboBox *combo = wxDynamicCast(win, wxComboBox); + wxCHECK_MSG( combo, 0, _T("should have combo as parent") ); - switch ( message ) - { - case WM_CHAR: if ( combo->MSWProcessEditMsg(message, wParam, lParam) ) return 0; - break; + } + break; -#if wxUSE_TOOLTIPS - case WM_NOTIFY: +#if 0 + case WM_GETDLGCODE: + { + wxCHECK_MSG( win, 0, _T("should have a parent") ); + + if ( win->GetWindowStyle() & wxPROCESS_ENTER ) { - NMHDR* hdr = (NMHDR *)lParam; - if ( (int)hdr->code == TTN_NEEDTEXT ) - { - wxToolTip *tooltip = combo->GetToolTip(); - if ( tooltip ) - { - TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam; - ttt->lpszText = (wxChar *)tooltip->GetTip().c_str(); - } - - // processed - return 0; - } + // need to return a custom dlg code or we'll never get it + return DLGC_WANTMESSAGE; } - break; + } + break; +#endif // 0 + + // deal with tooltips here +#if wxUSE_TOOLTIPS + case WM_NOTIFY: + { + wxCHECK_MSG( win, 0, _T("should have a parent") ); + + NMHDR* hdr = (NMHDR *)lParam; + if ( (int)hdr->code == TTN_NEEDTEXT ) + { + wxToolTip *tooltip = win->GetToolTip(); + if ( tooltip ) + { + TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam; + ttt->lpszText = (wxChar *)tooltip->GetTip().c_str(); + } + + // processed + return 0; + } + } + break; #endif // wxUSE_TOOLTIPS - } } return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam); @@ -130,9 +145,16 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam) { - if ( msg == WM_CHAR ) + switch ( msg ) { - return HandleChar(wParam, lParam, TRUE /* isASCII */); + case WM_CHAR: + return HandleChar(wParam, lParam, TRUE /* isASCII */); + + case WM_KEYDOWN: + return HandleKeyDown(wParam, lParam); + + case WM_KEYUP: + return HandleKeyUp(wParam, lParam); } return FALSE;