Fix deselecting items on branch toggle in wxTR_MULTIPLE control

Don't deselect all the other items when an item is collapsed or expanded
in wxGenericTreeCtrl with wxTR_MULTIPLE style, this was completely
unexpected and seems to have been accidentally introduced back in
35cf1ec63c

Closes #18680.
This commit is contained in:
Anton Triest
2020-03-16 00:30:41 +01:00
committed by Vadim Zeitlin
parent 8bc830337c
commit 0c6d6e6472

View File

@@ -3789,8 +3789,13 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
GetEventHandler()->ProcessEvent(nevent);
}
// Don't deselect anything if we're just collapsing or expanding
// the item.
if ( !(flags & wxTREE_HITTEST_ONITEMBUTTON) )
{
// this facilitates multiple-item drag-and-drop
if ( HasFlag(wxTR_MULTIPLE) && !(event.CmdDown() || event.ShiftDown()) )
if ( HasFlag(wxTR_MULTIPLE) &&
!(event.CmdDown() || event.ShiftDown()) )
{
wxArrayTreeItemIds selections;
if ( GetSelections(selections) > 1 )
@@ -3798,6 +3803,7 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
DoSelectItem(item, true, false);
}
}
}
if ( m_lastOnSame )
{