X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9467bdb7f5bfde9f99331097daacb93564ca122e..cb352236d9c7228e336a98c2c1a22e933c67e449:/src/univ/listbox.cpp?ds=sidebyside diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index a2697e5b41..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,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() ) {