]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/listctrl/listtest.cpp
Added fix to send scroll messages from mouse wheel instead of scrolling directly
[wxWidgets.git] / samples / listctrl / listtest.cpp
index 91341cae92636f71c616442db65b4e75b85d3852..d1c8d7d4af8d20c7d7e64cbb6871aa4e6dfc4a49 100644 (file)
@@ -681,9 +681,20 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
             break;
 
         case WXK_DELETE:
-            DeleteItem(event.GetIndex());
+            {
+                long item = GetNextItem(-1,
+                                        wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+                while ( item != -1 )
+                {
+                    DeleteItem(item);
+
+                    wxLogMessage(_T("Item %ld deleted"), item);
 
-            wxLogMessage(_T("Item %d deleted"), event.GetIndex());
+                    // -1 because the indices were shifted by DeleteItem()
+                    item = GetNextItem(item - 1,
+                                       wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+                }
+            }
             break;
 
         case WXK_INSERT: