From 58b3bdc93386b60b19de974277c92f0badca6d5d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 13 Mar 2000 17:20:39 +0000 Subject: [PATCH] added test for selection events git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/listctrl/listtest.cpp | 7 +++++++ samples/listctrl/listtest.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index c90a74ae76..229cad4224 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -57,6 +57,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(LIST_ICON_TEXT_VIEW, MyFrame::OnIconTextView) EVT_MENU(LIST_SMALL_ICON_VIEW, MyFrame::OnSmallIconView) EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW, MyFrame::OnSmallIconTextView) + 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_ALL, MyFrame::OnDeleteAll) @@ -165,6 +166,7 @@ MyFrame::MyFrame(const wxChar *title, int x, int y, int w, int h) menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, "Small icon &view with text\tF6"); wxMenu *menuList = new wxMenu; + menuList->Append(LIST_TOGGLE_FIRST, "&Toggle first item\tCtrl-T"); menuList->Append(LIST_DESELECT_ALL, "&Deselect All\tCtrl-D"); menuList->Append(LIST_SELECT_ALL, "S&elect All\tCtrl-A"); menuList->AppendSeparator(); @@ -258,6 +260,11 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) dialog.ShowModal(); } +void MyFrame::OnToggleFirstSel(wxCommandEvent& WXUNUSED(event)) +{ + m_listCtrl->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); +} + void MyFrame::OnDeselectAll(wxCommandEvent& WXUNUSED(event)) { int n = m_listCtrl->GetItemCount(); diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h index c1bf2d02b5..a79c15066c 100644 --- a/samples/listctrl/listtest.h +++ b/samples/listctrl/listtest.h @@ -66,6 +66,7 @@ public: void OnIconTextView(wxCommandEvent& event); void OnSmallIconView(wxCommandEvent& event); void OnSmallIconTextView(wxCommandEvent& event); + void OnToggleFirstSel(wxCommandEvent& event); void OnDeselectAll(wxCommandEvent& event); void OnSelectAll(wxCommandEvent& event); void OnDeleteAll(wxCommandEvent& event); @@ -107,6 +108,7 @@ enum LIST_SET_FG_COL, LIST_SET_BG_COL, LIST_TOGGLE_MULTI_SEL, + LIST_TOGGLE_FIRST, LIST_CTRL = 1000 }; -- 2.45.2