Clear old selection when wxListBox becomes empty.
When UpdateOldSelections() is called from wxListBox::DoClear(), it must clear the old selections array even for single selection list boxes, but it didn't do this under non-MSW platforms. Specifically check for the case of an empty listbox now and just forget the old selections then. This fixes the problem of keeping stale old selections and is also more efficient as we avoid the unnecessary GetSelections() call. Really closes #14359. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
125afca0c0
commit
0c9dd3b69b
@ -167,6 +167,14 @@ void wxListBoxBase::DeselectAll(int itemToLeaveSelected)
|
||||
|
||||
void wxListBoxBase::UpdateOldSelections()
|
||||
{
|
||||
// When the control becomes empty, any previously remembered selections are
|
||||
// invalid anyhow, so just forget them.
|
||||
if ( IsEmpty() )
|
||||
{
|
||||
m_oldSelections.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to remember the selection even in single-selection case on
|
||||
// Windows, so that we don't send an event when the user clicks on an
|
||||
// already selected item.
|
||||
|
Loading…
Reference in New Issue
Block a user