]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/listbox_osx.cpp
support icns in bundle
[wxWidgets.git] / src / osx / listbox_osx.cpp
index e7194b1b999116cb81cc2b8051ed42896e6b7513..624eb806ff1240f02dffb87961ce7bfd64dd622e 100644 (file)
@@ -24,8 +24,6 @@
     #include "wx/dcclient.h"
 #endif
 
-IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems)
-
 BEGIN_EVENT_TABLE(wxListBox, wxControl)
 END_EVENT_TABLE()
 
@@ -357,6 +355,14 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items,
 
     GetListPeer()->UpdateLineToEnd(startpos);
 
+    // Inserting the items may scroll the listbox down to show the last
+    // selected one but we don't want to do it as it could result in e.g. the
+    // first items of a listbox be hidden immediately after its creation so
+    // show the first selected item instead. Ideal would probably be to
+    // preserve the old selection unchanged, in fact, but I don't know how to
+    // get the first visible item so for now do at least this.
+    SetFirstItem(startpos);
+
     UpdateOldSelections();
 
     return idx;