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.
This commit is contained in:
Vadim Zeitlin
2020-01-07 03:12:21 +01:00
parent 2635360f3c
commit d62b79a11b

View File

@@ -40,6 +40,7 @@
#include "wx/combobox.h"
#include "wx/control.h"
#include "wx/dc.h"
#include "wx/srchctrl.h"
#include "wx/spinbutt.h"
#include "wx/textctrl.h"
#include "wx/validate.h"
@@ -459,6 +460,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;