Force current item to stay visible in wxListCtrl after deletion

The vertical scrollbar position could be updated (at least wit wxGTK) to
not show the last item any longer, after deleting the previously last
item, which was very annoying from the user point of view as the focus
was visually lost.

Avoid this by explicitly calling EnsureVisible() to prevent this from
happening.
This commit is contained in:
Vadim Zeitlin
2017-08-09 14:12:38 +02:00
parent 7e0093d61b
commit 99d7b13e3f

View File

@@ -4092,6 +4092,12 @@ void wxListMainWindow::DeleteItem( long lindex )
m_dirty = true;
RefreshAfter(index);
// This might be a wxGTK bug, but when deleting the last item in a control
// with many items, the vertical scroll position may change so that the new
// last item is not visible any longer, which is very annoying from the
// user point of view. Ensure that whatever happens, this item is visible.
EnsureVisible(m_current);
}
void wxListMainWindow::DeleteColumn( int col )