]> git.saurik.com Git - wxWidgets.git/commitdiff
adjust m_current when inserting items in the control (patch 799937)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Sep 2003 22:59:02 +0000 (22:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Sep 2003 22:59:02 +0000 (22:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index 771d738f7a3e16aab2f9680bc4b50ad71958fc4b..16404fbf74ee3700a9cb7fc70c3784539ee3bc05 100644 (file)
@@ -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);