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:
parent
79323592eb
commit
bbb03ec995
@ -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
|
||||
{
|
||||
|
@ -170,6 +170,12 @@ void ListBoxTestCase::MultipleSelect()
|
||||
CPPUNIT_ASSERT(!m_list->IsSelected(1));
|
||||
CPPUNIT_ASSERT(m_list->IsSelected(2));
|
||||
CPPUNIT_ASSERT(!m_list->IsSelected(3));
|
||||
|
||||
m_list->SetSelection(0);
|
||||
m_list->SetSelection(wxNOT_FOUND);
|
||||
|
||||
m_list->GetSelections(selected);
|
||||
CPPUNIT_ASSERT_EQUAL(0, selected.Count());
|
||||
}
|
||||
|
||||
void ListBoxTestCase::ClickEvents()
|
||||
|
Loading…
Reference in New Issue
Block a user