delete test added

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10661 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-06-23 22:24:33 +00:00
parent 87df17a11b
commit bec0a26172
2 changed files with 16 additions and 0 deletions

View 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;

View 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,