X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/86351e4a9d12822b31f2052fe299fc6be6d5f44d..6f054ac5e8f4d9daf9f4d7fabfa285cb7b148d17:/src/generic/listctrl.cpp?ds=sidebyside 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);