From b2ab6c99e42259a18ba948885eaa3d0cf64f5188 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 7 Jan 2020 03:12:21 +0100 Subject: [PATCH] Fix wxCommandEvent::GetString() for wxSearchCtrl events wxEVT_TEXT events generated by native wxSearchCtrl implementations always returned an empty string, as wxSearchCtrl was not recognized by the special hack inside wxCommandEvent::GetString() which retrieved the text on demand. Fix this by adding yet another special case for this. This is not ideal, but should do for now. --- src/common/event.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/common/event.cpp b/src/common/event.cpp index d10275b49b..f96df0bb26 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -46,6 +46,10 @@ #endif // wxUSE_GUI #endif +#if wxUSE_GUI + #include "wx/srchctrl.h" +#endif // wxUSE_GUI + #include "wx/thread.h" #if wxUSE_BASE @@ -459,6 +463,12 @@ wxString wxCommandEvent::GetString() const if ( combo ) return combo->GetValue(); #endif // wxUSE_COMBOBOX + +#if wxUSE_SEARCHCTRL + wxSearchCtrl* search = wxDynamicCast(m_eventObject, wxSearchCtrl); + if ( search ) + return search->GetValue(); +#endif // wxUSE_SEARCHCTRL } return m_cmdString;