]> git.saurik.com Git - wxWidgets.git/commitdiff
SetSelection(wxNOT_FOUND) now works correctly.
authorJulian Smart <julian@anthemion.co.uk>
Tue, 17 Oct 2006 18:21:05 +0000 (18:21 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 17 Oct 2006 18:21:05 +0000 (18:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42081 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/univ/combobox.cpp
src/univ/listbox.cpp

index 28ae78ee6d4f6d545a0af13498fc1be5da241cd9..89130b4e3cc35fd1360f6d8758c712c4a53c70c9 100644 (file)
@@ -145,9 +145,9 @@ void wxComboListBox::SetStringValue(const wxString& value)
 {
     if ( !value.empty() )
     {
-               if (FindString(value) != wxNOT_FOUND)
-               wxListBox::SetStringSelection(value);
-       }
+        if (FindString(value) != wxNOT_FOUND)
+            wxListBox::SetStringSelection(value);
+    }
     else
         wxListBox::SetSelection(-1);
 }
@@ -386,10 +386,11 @@ int wxComboBox::FindString(const wxString& s, bool bCase) const
 
 void wxComboBox::SetSelection(int n)
 {
-    wxCHECK_RET( IsValid(n), _T("invalid index in wxComboBox::Select") );
+    wxCHECK_RET( (n == wxNOT_FOUND || IsValid(n)), _T("invalid index in wxComboBox::Select") );
 
     GetLBox()->SetSelection(n);
-    if ( GetTextCtrl() ) GetTextCtrl()->SetValue(GetLBox()->GetString(n));
+    if ( GetTextCtrl() )
+        GetTextCtrl()->SetValue(GetLBox()->GetString(n));
 }
 
 int wxComboBox::GetSelection() const
index a2697e5b41310e86e9afec18db5d42271a05d67c..7657a08ac6cdc569717c8af40d9d6bb3d5d16c6a 100644 (file)
@@ -483,6 +483,7 @@ void wxListBox::DoSetSelection(int n, bool select)
                 // selecting an item in a single selection listbox deselects
                 // all the others
                 DeselectAll();
+                return;
             }
 
             m_selections.Add(n);