]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/listbox.cpp
added code for checking if the current locale is UTF-8 at runtime
[wxWidgets.git] / src / univ / listbox.cpp
index a2697e5b41310e86e9afec18db5d42271a05d67c..7aaa9953f3386770ef2632676beca0ec029c3d54 100644 (file)
@@ -196,7 +196,7 @@ bool wxListBox::Create(wxWindow *parent,
 
     Set(n, choices);
 
-    SetBestSize(size);
+    SetInitialSize(size);
 
     CreateInputHandler(wxINP_HANDLER_LISTBOX);
 
@@ -476,7 +476,16 @@ void wxListBox::DoSetSelection(int n, bool select)
 {
     if ( select )
     {
-        if ( m_selections.Index(n) == wxNOT_FOUND )
+        if ( n == wxNOT_FOUND )
+        {
+            if ( !HasMultipleSelection() )
+            {
+                // selecting wxNOT_FOUND is documented to deselect all items
+                DeselectAll();
+                return;
+            }
+        }
+        else if ( m_selections.Index(n) == wxNOT_FOUND )
         {
             if ( !HasMultipleSelection() )
             {