X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6fc052ae5c77cbf627d9d5f076ad93cd3a3e5a5..4542739ccb3b2ad47afc66b7a3182568a182b71f:/src/univ/listbox.cpp diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index 7657a08ac6..7aaa9953f3 100644 --- a/src/univ/listbox.cpp +++ b/src/univ/listbox.cpp @@ -196,7 +196,7 @@ bool wxListBox::Create(wxWindow *parent, Set(n, choices); - SetBestSize(size); + SetInitialSize(size); CreateInputHandler(wxINP_HANDLER_LISTBOX); @@ -476,14 +476,22 @@ 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() ) { // selecting an item in a single selection listbox deselects // all the others DeselectAll(); - return; } m_selections.Add(n);