Move WM_CHAR handling inside the switch in wxTextCtrl code

No real changes, just check for WM_CHAR inside the existing "switch"
instead of writing a separate "if" statement just for it.

Note that removing HasFlag(wxTE_PROCESS_ENTER) test shouldn't matter as
we should be only getting WM_CHAR for VK_RETURN when this flag is used.
This commit is contained in:
Vadim Zeitlin
2019-07-14 01:40:13 +02:00
parent 17f9a71586
commit c43e0fa123

View File

@@ -2178,6 +2178,9 @@ wxTextCtrl::MSWHandleMessage(WXLRESULT *rc,
{ {
bool processed = wxTextCtrlBase::MSWHandleMessage(rc, nMsg, wParam, lParam); bool processed = wxTextCtrlBase::MSWHandleMessage(rc, nMsg, wParam, lParam);
switch ( nMsg )
{
case WM_CHAR:
// Handle the special case of "Enter" key: the user code needs to specify // Handle the special case of "Enter" key: the user code needs to specify
// wxTE_PROCESS_ENTER style to get it in the first place, but if this flag // wxTE_PROCESS_ENTER style to get it in the first place, but if this flag
// is used, then even if the wxEVT_TEXT_ENTER handler skips the event, the // is used, then even if the wxEVT_TEXT_ENTER handler skips the event, the
@@ -2188,17 +2191,13 @@ wxTextCtrl::MSWHandleMessage(WXLRESULT *rc,
// Fix these problems by explicitly performing the default function of this // Fix these problems by explicitly performing the default function of this
// key (which would be done by MSWProcessMessage() if we didn't have // key (which would be done by MSWProcessMessage() if we didn't have
// wxTE_PROCESS_ENTER) and preventing the default WndProc from getting it. // wxTE_PROCESS_ENTER) and preventing the default WndProc from getting it.
if ( nMsg == WM_CHAR && if ( !processed && wParam == VK_RETURN )
!processed &&
HasFlag(wxTE_PROCESS_ENTER) &&
wParam == VK_RETURN )
{ {
if ( ClickDefaultButtonIfPossible() ) if ( ClickDefaultButtonIfPossible() )
processed = true; processed = true;
} }
break;
switch ( nMsg )
{
case WM_GETDLGCODE: case WM_GETDLGCODE:
{ {
// Ensure that the result value is initialized even if the base // Ensure that the result value is initialized even if the base