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
This commit is contained in:
Vadim Zeitlin
2000-04-14 22:38:51 +00:00
parent e10b3395bc
commit c617e0de6b

View File

@@ -80,32 +80,48 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
if (
message == WM_CHAR
#if wxUSE_TOOLTIPS
|| message == WM_NOTIFY
#endif // wxUSE_TOOLTIPS
)
{
HWND hwndCombo = ::GetParent(hWnd); HWND hwndCombo = ::GetParent(hWnd);
wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo); wxWindow *win = wxFindWinFromHandle((WXHWND)hwndCombo);
wxComboBox *combo = wxDynamicCast(win, wxComboBox);
wxCHECK_MSG( combo, 0, _T("should have combo as parent") );
switch ( message ) switch ( message )
{ {
// forward some messages to the combobox
case WM_KEYUP:
case WM_KEYDOWN:
case WM_CHAR: case WM_CHAR:
{
wxComboBox *combo = wxDynamicCast(win, wxComboBox);
wxCHECK_MSG( combo, 0, _T("should have combo as parent") );
if ( combo->MSWProcessEditMsg(message, wParam, lParam) ) if ( combo->MSWProcessEditMsg(message, wParam, lParam) )
return 0; return 0;
}
break; break;
#if 0
case WM_GETDLGCODE:
{
wxCHECK_MSG( win, 0, _T("should have a parent") );
if ( win->GetWindowStyle() & wxPROCESS_ENTER )
{
// need to return a custom dlg code or we'll never get it
return DLGC_WANTMESSAGE;
}
}
break;
#endif // 0
// deal with tooltips here
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
case WM_NOTIFY: case WM_NOTIFY:
{ {
wxCHECK_MSG( win, 0, _T("should have a parent") );
NMHDR* hdr = (NMHDR *)lParam; NMHDR* hdr = (NMHDR *)lParam;
if ( (int)hdr->code == TTN_NEEDTEXT ) if ( (int)hdr->code == TTN_NEEDTEXT )
{ {
wxToolTip *tooltip = combo->GetToolTip(); wxToolTip *tooltip = win->GetToolTip();
if ( tooltip ) if ( tooltip )
{ {
TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam; TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam;
@@ -119,7 +135,6 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd,
break; break;
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS
} }
}
return ::CallWindowProc(CASTWNDPROC gs_wndprocEdit, hWnd, message, wParam, lParam); 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) bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
{ {
if ( msg == WM_CHAR ) switch ( msg )
{ {
case WM_CHAR:
return HandleChar(wParam, lParam, TRUE /* isASCII */); return HandleChar(wParam, lParam, TRUE /* isASCII */);
case WM_KEYDOWN:
return HandleKeyDown(wParam, lParam);
case WM_KEYUP:
return HandleKeyUp(wParam, lParam);
} }
return FALSE; return FALSE;