From: Vadim Zeitlin Date: Sun, 14 Sep 2003 22:59:02 +0000 (+0000) Subject: adjust m_current when inserting items in the control (patch 799937) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ab96d680eb7589365c67147589cc60e4ec9bbbb9 adjust m_current when inserting items in the control (patch 799937) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 771d738f7a..16404fbf74 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4365,6 +4365,14 @@ void wxListMainWindow::InsertItem( wxListItem &item ) m_dirty = TRUE; + // If an item is selected at or below the point of insertion, we need to + // increment the member variables because the current row's index has gone + // up by one + if ( HasCurrent() && m_current >= id ) + { + m_current++; + } + SendNotify(id, wxEVT_COMMAND_LIST_INSERT_ITEM); RefreshLines(id, GetItemCount() - 1);