diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 6ee2ff9c0b..cc64246844 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -2216,7 +2216,7 @@ wxTextCtrl::MSWHandleMessage(WXLRESULT *rc, // Fix these problems by explicitly performing the default function of this // key (which would be done by MSWProcessMessage() if we didn't have // wxTE_PROCESS_ENTER) and preventing the default WndProc from getting it. - if ( !processed && wParam == VK_RETURN ) + if ( !processed && wParam == VK_RETURN && IsSingleLine() ) { if ( ClickDefaultButtonIfPossible() ) processed = true; diff --git a/tests/controls/textentrytest.cpp b/tests/controls/textentrytest.cpp index ab65a7c622..44bc437d89 100644 --- a/tests/controls/textentrytest.cpp +++ b/tests/controls/textentrytest.cpp @@ -443,8 +443,10 @@ private: { case ProcessEnter_No: case ProcessEnter_ButSkip: - // We consider that the text succeeded. - EndModal(wxID_OK); + // We consider that the text succeeded, but in a different way, + // so use a different ID to be able to distinguish between this + // scenario and Enter activating the default button. + EndModal(wxID_CLOSE); break; case ProcessEnter_WithoutSkipping: @@ -521,7 +523,7 @@ void TestProcessEnter(const TextLikeControlCreator& controlCreator) return; TestDialog dlg(*multiLineCreator, ProcessEnter_No); - REQUIRE( dlg.ShowModal() == wxID_OK ); + REQUIRE( dlg.ShowModal() == wxID_CLOSE ); CHECK( !dlg.GotEnter() ); } @@ -533,7 +535,7 @@ void TestProcessEnter(const TextLikeControlCreator& controlCreator) return; TestDialog dlg(*multiLineCreator, ProcessEnter_ButSkip); - REQUIRE( dlg.ShowModal() == wxID_OK ); + REQUIRE( dlg.ShowModal() == wxID_CLOSE ); CHECK( dlg.GotEnter() ); }