Fix bug in GetRowByItem() in generic wxDataViewCtrl
If the item was not found at all, which can happen if all its parents are not expanded, this function still returned a valid but completely wrong row index. This affected many functions which could call it for the items which were not necessarily visible, i.e. all of them except for the event handlers as events can only affect the visible items, including but not limited to SetCurrentItem(), all the selection-related functions, all the expansion-related functions, EnsureVisible(), HitTest() and GetItemRect().
This commit is contained in:
@@ -3920,7 +3920,9 @@ int wxDataViewMainWindow::GetRowByItem(const wxDataViewItem & item) const
|
||||
// the parent chain was created by adding the deepest parent first.
|
||||
// so if we want to start at the root node, we have to iterate backwards through the vector
|
||||
ItemToRowJob job( item, parentChain.rbegin() );
|
||||
Walker( m_root, job );
|
||||
if ( !Walker( m_root, job ) )
|
||||
return -1;
|
||||
|
||||
return job.GetResult();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user