]> git.saurik.com Git - wxWidgets.git/commitdiff
delete test added
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 23 Jun 2001 22:24:33 +0000 (22:24 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 23 Jun 2001 22:24:33 +0000 (22:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10661 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/listctrl/listtest.cpp
samples/listctrl/listtest.h

index 5ebd4f6568218228e0677142dbfd6cf48a2837ab..345620a545d23925cf882b2038d2ab46c43d311e 100644 (file)
@@ -61,6 +61,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_MENU(LIST_TOGGLE_FIRST, MyFrame::OnToggleFirstSel)
     EVT_MENU(LIST_DESELECT_ALL, MyFrame::OnDeselectAll)
     EVT_MENU(LIST_SELECT_ALL, MyFrame::OnSelectAll)
+    EVT_MENU(LIST_DELETE, MyFrame::OnDelete)
     EVT_MENU(LIST_DELETE_ALL, MyFrame::OnDeleteAll)
     EVT_MENU(LIST_SORT, MyFrame::OnSort)
     EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
@@ -178,6 +179,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h)
     menuList->AppendSeparator();
     menuList->Append(LIST_SORT, "&Sort\tCtrl-S");
     menuList->AppendSeparator();
+    menuList->Append(LIST_DELETE, "&Delete first item");
     menuList->Append(LIST_DELETE_ALL, "Delete &all items");
     menuList->AppendSeparator();
     menuList->Append(LIST_TOGGLE_MULTI_SEL, "&Multiple selection\tCtrl-M",
@@ -482,6 +484,18 @@ void MyFrame::OnSetBgColour(wxCommandEvent& WXUNUSED(event))
     m_listCtrl->Refresh();
 }
 
+void MyFrame::OnDelete(wxCommandEvent& WXUNUSED(event))
+{
+    if ( m_listCtrl->GetItemCount() )
+    {
+        m_listCtrl->DeleteItem(0);
+    }
+    else
+    {
+        m_logWindow->WriteText("Nothing to delete");
+    }
+}
+
 void MyFrame::OnDeleteAll(wxCommandEvent& WXUNUSED(event))
 {
     wxStopWatch sw;
index e0ca2f31f7fc5198cc903a7e84987b3f61a669ad..29e351e1ffa679db3ab698d805154a2e9a001165 100644 (file)
@@ -69,6 +69,7 @@ public:
     void OnToggleFirstSel(wxCommandEvent& event);
     void OnDeselectAll(wxCommandEvent& event);
     void OnSelectAll(wxCommandEvent& event);
+    void OnDelete(wxCommandEvent& event);
     void OnDeleteAll(wxCommandEvent& event);
     void OnSort(wxCommandEvent& event);
     void OnSetFgColour(wxCommandEvent& event);
@@ -106,6 +107,7 @@ enum
     BUSY_ON                     = 10,
     BUSY_OFF                    = 11,
     LIST_DELETE_ALL             = 12,
+    LIST_DELETE,
     LIST_SORT,
     LIST_SET_FG_COL,
     LIST_SET_BG_COL,