Update current item in generic wxDataViewCtrl::SetSelections()

SetSelections was clearing the previous selection, invalidating the
current item, but didn't set it after selecting the new items.

This was causing issues in keyboard selection, e.g. pressing Shift+click
didn't select all the items between the selected and the clicked ones.

Fix this by making the last item of the new selection current, which is
the expected behaviour considering that SetSelections() should be
equivalent to calling SetSelection() with all items one by one.

Signed-off-by: Anil Kumar <anilkumar8753@gmail.com>

Closes https://github.com/wxWidgets/wxWidgets/pull/557
This commit is contained in:
Anil Kumar
2017-09-18 12:43:58 +05:30
committed by Vadim Zeitlin
parent 78fdea89b1
commit 22a4feea53

View File

@@ -5414,6 +5414,9 @@ void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel )
{
m_clientArea->ClearSelection();
if ( sel.empty() )
return;
wxDataViewItem last_parent;
for ( size_t i = 0; i < sel.size(); i++ )
@@ -5431,6 +5434,9 @@ void wxDataViewCtrl::SetSelections( const wxDataViewItemArray & sel )
if( row >= 0 )
m_clientArea->SelectRow(static_cast<unsigned int>(row), true);
}
// Also make the last item as current item
DoSetCurrentItem(sel.Last());
}
void wxDataViewCtrl::Select( const wxDataViewItem & item )