Fix skipping the event in wxEVT_TEXT_ENTER handler in wxMSW

Skipping the event is supposed to have the same effect as not handling the
event at all, but in wxMSW wxTE_PROCESS_ENTER style must be specified for a
wxEVT_TEXT_ENTER handler to be executed at all and if this style is used, then
the default handling in MSWProcessMessage() which normally happens before
calling the handler doesn't take place at all.

Work around this by explicitly performing the default "Enter" key action if
the event generated by it wasn't handled to make wxMSW behaviour more
intuitive.
This commit is contained in:
Vadim Zeitlin
2015-11-19 01:15:07 +01:00
parent 99a1526ee3
commit 4edae7238a
2 changed files with 29 additions and 1 deletions

View File

@@ -2603,7 +2603,14 @@ void TestDefaultActionDialog::OnCatchListBoxDClick(wxCommandEvent& WXUNUSED(even
void TestDefaultActionDialog::OnTextEnter(wxCommandEvent& event)
{
wxLogMessage("Text \"%s\" entered.", event.GetString());
const wxString& text = event.GetString();
if ( text.empty() )
{
event.Skip();
return;
}
wxLogMessage("Text \"%s\" entered.", text);
}
void MyFrame::OnTestDefaultActionDialog(wxCommandEvent& WXUNUSED(event))