]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/listbox.cpp
Rework the wxCusor ctor taking wx stock number to provide as many cursors as
[wxWidgets.git] / src / univ / listbox.cpp
index 7657a08ac6cdc569717c8af40d9d6bb3d5d16c6a..7aaa9953f3386770ef2632676beca0ec029c3d54 100644 (file)
@@ -196,7 +196,7 @@ bool wxListBox::Create(wxWindow *parent,
 
     Set(n, choices);
 
 
     Set(n, choices);
 
-    SetBestSize(size);
+    SetInitialSize(size);
 
     CreateInputHandler(wxINP_HANDLER_LISTBOX);
 
 
     CreateInputHandler(wxINP_HANDLER_LISTBOX);
 
@@ -476,14 +476,22 @@ void wxListBox::DoSetSelection(int n, bool select)
 {
     if ( 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() )
             {
                 // selecting an item in a single selection listbox deselects
                 // all the others
                 DeselectAll();
         {
             if ( !HasMultipleSelection() )
             {
                 // selecting an item in a single selection listbox deselects
                 // all the others
                 DeselectAll();
-                return;
             }
 
             m_selections.Add(n);
             }
 
             m_selections.Add(n);