Don't eat TAB presses for wxComboBox with wxTE_PROCESS_ENTER in wxMSW.

Still allow to use TAB for navigation even when a wxComboBox has
wxTE_PROCESS_ENTER style.

Use the same hack for wxTextCtrl, i.e. implement the navigation ourselves as
we can't let IsDialogMessage() handle it but still get VK_ENTER key presses.

Closes #12808.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75216 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-11-16 23:41:16 +00:00
parent 12c6d5061a
commit 9a49e0c42f

View File

@@ -228,7 +228,9 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
case WM_CHAR:
// for compatibility with wxTextCtrl, generate a special message
// when Enter is pressed
if ( wParam == VK_RETURN )
switch ( wParam )
{
case VK_RETURN:
{
if (SendMessage(GetHwnd(), CB_GETDROPPEDSTATE, 0, 0))
return false;
@@ -248,9 +250,27 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
return true;
}
}
// fall through, WM_CHAR is one of the message we should forward.
break;
case VK_TAB:
// If we have wxTE_PROCESS_ENTER style, we get all char
// events, including those for TAB which are usually used
// for keyboard navigation, but we should not process them
// unless we also have wxTE_PROCESS_TAB style.
if ( !HasFlag(wxTE_PROCESS_TAB) )
{
int flags = 0;
if ( !wxIsShiftDown() )
flags |= wxNavigationKeyEvent::IsForward;
if ( wxIsCtrlDown() )
flags |= wxNavigationKeyEvent::WinChange;
if ( Navigate(flags) )
return true;
}
break;
}
}
default:
if ( ShouldForwardFromEditToCombo(msg) )
{
// For all the messages forward from the edit control the
@@ -258,7 +278,6 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
WXLRESULT result;
return MSWHandleMessage(&result, msg, wParam, lParam);
}
}
return false;
}