]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/combobox.cpp
Only use Unix/X11-specific files under Unix in wxGTK.
[wxWidgets.git] / src / gtk / combobox.cpp
index 045c6166ba478c697e6651a2bee894aafd52d198..62da3070c9d58f0160d52c141d1f7355d29d5c14 100644 (file)
@@ -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<int>(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
 // ----------------------------------------------------------------------------