Deselect all items in wxMSW wxListBox when selection is set to -1.

Even though this behaviour is somewhat counterintuitive, the documentation
mentions that this is what should happen and wxGTK and wxOSX already behave
like this so bring wxMSW in line.

wxListBox::DeselectAll() should probably just call SetSelection(wxNOT_FOUND)
when the item to leave selected is not specified too now.

Closes #12705.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-11-23 13:10:54 +00:00
parent 79323592eb
commit bbb03ec995
2 changed files with 11 additions and 1 deletions

View File

@@ -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
{