Fix wxSearchCtrl::ChangeValue() to actually change value

This was broken because wxSearchCtrl inherited the base class version of
ChangeValue() which didn't really work for it due to the poor way in
which wxTextEntry is designed (see #18071).

Closes #16998.
This commit is contained in:
Vadim Zeitlin
2018-01-29 19:33:29 +01:00
parent 05ebeb6bac
commit 58ac3d3690
2 changed files with 10 additions and 0 deletions

View File

@@ -88,6 +88,8 @@ public:
// operations // operations
// ---------- // ----------
virtual void ChangeValue(const wxString& value) wxOVERRIDE;
// editing // editing
virtual void Clear() wxOVERRIDE; virtual void Clear() wxOVERRIDE;
virtual void Replace(long from, long to, const wxString& value) wxOVERRIDE; virtual void Replace(long from, long to, const wxString& value) wxOVERRIDE;

View File

@@ -915,6 +915,14 @@ wxTextCtrl& operator<<(double d);
wxTextCtrl& operator<<(const wxChar c); wxTextCtrl& operator<<(const wxChar c);
#endif #endif
// Note that overriding DoSetValue() is currently insufficient because the base
// class ChangeValue() only updates m_hintData of this object (which is null
// anyhow), instead of updating m_text->m_hintData, see #16998.
void wxSearchCtrl::ChangeValue(const wxString& value)
{
m_text->ChangeValue(value);
}
void wxSearchCtrl::DoSetValue(const wxString& value, int flags) void wxSearchCtrl::DoSetValue(const wxString& value, int flags)
{ {
m_text->DoSetValue(value, flags); m_text->DoSetValue(value, flags);