X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9467bdb7f5bfde9f99331097daacb93564ca122e..3febc967a929bd07e339bc19d799cf0315e1802a:/src/univ/combobox.cpp?ds=sidebyside diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index 28ae78ee6d..89130b4e3c 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -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