]> git.saurik.com Git - wxWidgets.git/commitdiff
fix appending items to sorted control (patch 1940384)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 May 2008 19:59:17 +0000 (19:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 11 May 2008 19:59:17 +0000 (19:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/generic/odcombo.cpp

index 2c01c0deb9dbf4d4eeede2fecce15d61e375f4ff..dfc732b91a646977cd0e5c58a7aa477c2ef8475d 100644 (file)
@@ -318,6 +318,7 @@ All (GUI):
 - Generalized wxScrolledWindow into wxScrolled<T> template that can derive
   from any window class, not just wxPanel.
 - Allow having menu separators with ids != wxID_SEPARATOR (Jeff Tupper)
+- Fix appending items to sorted wxComboCtrl after creation (Jaakko Salli)
 
 wxGTK:
 
index d04d183089b35f8ad9f9a8b037d6ab84116d682a..fa036b21e2964558b20a8e09c16d0bc7666de481 100644 (file)
@@ -1027,13 +1027,29 @@ int wxOwnerDrawnComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
     EnsurePopupControl();
 
     const unsigned int count = items.GetCount();
-    for( unsigned int i = 0; i < count; ++i, ++pos )
+
+    if ( HasFlag(wxCB_SORT) )
     {
-        GetVListBoxComboPopup()->Insert(items[i], pos);
-        AssignNewItemClientData(pos, clientData, i, type);
+        int n = pos;
+
+        for ( unsigned int i = 0; i < count; ++i )
+        {
+            int n = GetVListBoxComboPopup()->Append(items[i]);
+            AssignNewItemClientData(n, clientData, i, type);
+        }
+
+        return n;
     }
+    else
+    {
+        for ( unsigned int i = 0; i < count; ++i, ++pos )
+        {
+            GetVListBoxComboPopup()->Insert(items[i], pos);
+            AssignNewItemClientData(pos, clientData, i, type);
+        }
 
-    return pos - 1;
+        return pos - 1;
+    }
 }
 
 void wxOwnerDrawnComboBox::DoSetItemClientData(unsigned int n, void* clientData)