fixed bug with deletion of several last items in wxListCtrl, added tests for it in the sample

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-23 14:57:01 +00:00
parent d9ff0f91fb
commit 91c6cc0e71
2 changed files with 34 additions and 19 deletions

View 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 %d deleted"), event.GetIndex());
wxLogMessage(_T("Item %ld deleted"), item);
// -1 because the indices were shifted by DeleteItem()
item = GetNextItem(item - 1,
wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
}
}
break;
case WXK_INSERT: