Show how to iterate selected items in a wxListCtrl.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22372 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2003-07-29 20:39:19 +00:00
parent 6921cf96a0
commit 62fc00206f

View File

@ -292,7 +292,7 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
menu = wxMenu() menu = wxMenu()
# add some items # add some items
menu.Append(self.popupID1, "FindItem tests") 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.popupID3, "ClearAll and repopulate")
menu.Append(self.popupID4, "DeleteAllItems") menu.Append(self.popupID4, "DeleteAllItems")
menu.Append(self.popupID5, "GetItem") menu.Append(self.popupID5, "GetItem")
@ -310,7 +310,12 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
print "FindItemData:", self.list.FindItemData(-1, 11) print "FindItemData:", self.list.FindItemData(-1, 11)
def OnPopupTwo(self, event): 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): def OnPopupThree(self, event):
self.log.WriteText("Popup three\n") self.log.WriteText("Popup three\n")