From 21de2c2911fb2e8b12b3ecadaf10238de49f3949 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 31 Jul 2003 17:12:36 +0000 Subject: [PATCH] Show how to iterate selected items git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@22415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/demo/wxListCtrl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wxPython/demo/wxListCtrl.py b/wxPython/demo/wxListCtrl.py index 501b148a3c..2cd3adcda1 100644 --- a/wxPython/demo/wxListCtrl.py +++ b/wxPython/demo/wxListCtrl.py @@ -292,7 +292,7 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin): menu = wxMenu() # add some items menu.Append(self.popupID1, "FindItem tests") -# menu.Append(self.popupID2, "Two") + menu.Append(self.popupID2, "Iterate Selected") menu.Append(self.popupID3, "ClearAll and repopulate") menu.Append(self.popupID4, "DeleteAllItems") menu.Append(self.popupID5, "GetItem") @@ -310,7 +310,11 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin): print "FindItemData:", self.list.FindItemData(-1, 11) def OnPopupTwo(self, event): - self.log.WriteText("Popup two\n") + self.log.WriteText("Selected items:\n") + index = self.list.GetFirstSelected() + while index != -1: + self.log.WriteText(" %s: %s\n" % (self.list.GetItemText(index), self.getColumnText(index, 1))) + index = self.list.GetNextSelected(index) def OnPopupThree(self, event): self.log.WriteText("Popup three\n")