X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/24ee1bef74a8f403ad3df207edd9d656648c4da5..cc3977bf132d40cb66c6b488890ef67a396d4a0a:/src/msw/listbox.cpp diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 52fe4d0c4d..97bbe92840 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -351,7 +351,11 @@ void wxListBox::DoSetSelection(int N, bool select) if ( HasMultipleSelection() ) { - SendMessage(GetHwnd(), LB_SETSEL, select, N); + // Setting selection to -1 should deselect everything. + const bool deselectAll = N == wxNOT_FOUND; + SendMessage(GetHwnd(), LB_SETSEL, + deselectAll ? FALSE : select, + deselectAll ? -1 : N); } else {