Don't activate default button on Enter in multiline wxTextCtrl
Restore behaviour until c43e0fa123
and let
Enter presses in multiline text controls perform their default function
in the control instead of closing the dialog.
Make the unit test more discerning to check for this.
This commit is contained in:
@@ -2216,7 +2216,7 @@ 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 ( !processed && wParam == VK_RETURN )
|
if ( !processed && wParam == VK_RETURN && IsSingleLine() )
|
||||||
{
|
{
|
||||||
if ( ClickDefaultButtonIfPossible() )
|
if ( ClickDefaultButtonIfPossible() )
|
||||||
processed = true;
|
processed = true;
|
||||||
|
@@ -443,8 +443,10 @@ private:
|
|||||||
{
|
{
|
||||||
case ProcessEnter_No:
|
case ProcessEnter_No:
|
||||||
case ProcessEnter_ButSkip:
|
case ProcessEnter_ButSkip:
|
||||||
// We consider that the text succeeded.
|
// We consider that the text succeeded, but in a different way,
|
||||||
EndModal(wxID_OK);
|
// so use a different ID to be able to distinguish between this
|
||||||
|
// scenario and Enter activating the default button.
|
||||||
|
EndModal(wxID_CLOSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProcessEnter_WithoutSkipping:
|
case ProcessEnter_WithoutSkipping:
|
||||||
@@ -521,7 +523,7 @@ void TestProcessEnter(const TextLikeControlCreator& controlCreator)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TestDialog dlg(*multiLineCreator, ProcessEnter_No);
|
TestDialog dlg(*multiLineCreator, ProcessEnter_No);
|
||||||
REQUIRE( dlg.ShowModal() == wxID_OK );
|
REQUIRE( dlg.ShowModal() == wxID_CLOSE );
|
||||||
CHECK( !dlg.GotEnter() );
|
CHECK( !dlg.GotEnter() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,7 +535,7 @@ void TestProcessEnter(const TextLikeControlCreator& controlCreator)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TestDialog dlg(*multiLineCreator, ProcessEnter_ButSkip);
|
TestDialog dlg(*multiLineCreator, ProcessEnter_ButSkip);
|
||||||
REQUIRE( dlg.ShowModal() == wxID_OK );
|
REQUIRE( dlg.ShowModal() == wxID_CLOSE );
|
||||||
CHECK( dlg.GotEnter() );
|
CHECK( dlg.GotEnter() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user