X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/385e8575dd1f9219fb0e3f7fa26ffe4c24d2fdbb..11716cbe14313011016472f56edb51c55aabe852:/src/gtk/combobox.cpp?ds=sidebyside diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 045c6166ba..62da3070c9 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -282,6 +282,23 @@ void wxComboBox::SetValue(const wxString& value) wxTextEntry::SetValue(value); } +void wxComboBox::SetString(unsigned int n, const wxString& text) +{ + wxChoice::SetString(n, text); + + if ( static_cast(n) == GetSelection() ) + { + // We also need to update the currently shown text, for consistency + // with wxMSW and also because it makes sense as leaving the old string + // in the text but not in the list would be confusing to the user. + SetValue(text); + + // And we need to keep the selection unchanged, modifying the item is + // not supposed to deselect it. + SetSelection(n); + } +} + // ---------------------------------------------------------------------------- // standard event handling // ----------------------------------------------------------------------------