]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxListCtrl.py
Tcl regex lib
[wxWidgets.git] / wxPython / demo / wxListCtrl.py
index 9c23d2e6749d5d8b21b849682e96f0c5674a6586..d1b9cf245f1f43899293fbf7fb1f75d06d192a2b 100644 (file)
@@ -105,7 +105,7 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
         self.list.SetImageList(self.il, wxIMAGE_LIST_SMALL)
 
         #  Why doesn't this show up on MSW???
-        self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
+        #self.list.SetToolTip(wxToolTip("This is a ToolTip!"))
 
         if 0:
             # for normal, simple columns, you can add them like this:
@@ -163,6 +163,7 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
         self.currentItem = 0
         EVT_SIZE(self, self.OnSize)
         EVT_LIST_ITEM_SELECTED(self, tID, self.OnItemSelected)
+        EVT_LIST_ITEM_DESELECTED(self, tID, self.OnItemDeselected)
         EVT_LIST_ITEM_ACTIVATED(self, tID, self.OnItemActivated)
         EVT_LIST_DELETE_ITEM(self, tID, self.OnItemDelete)
         EVT_LIST_COL_CLICK(self, tID, self.OnColClick)
@@ -217,6 +218,13 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
             # this does
             self.list.SetItemState(10, 0, wxLIST_STATE_SELECTED)
 
+    # Show how to reselect something we don't want deselected
+    def OnItemDeselected(self, evt):
+        item = evt.GetItem()
+        if evt.m_itemIndex == 11:
+            wxCallAfter(self.list.SetItemState, 11, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED)
+
+
     def OnItemActivated(self, event):
         self.currentItem = event.m_itemIndex
         self.log.WriteText("OnItemActivated: %s\n" % self.list.GetItemText(self.currentItem))
@@ -280,6 +288,8 @@ class TestListCtrlPanel(wxPanel, wxColumnSorterMixin):
 
     def OnPopupOne(self, event):
         self.log.WriteText("Popup one\n")
+        print "FindItem:", self.list.FindItem(-1, "Roxette")
+        print "FindItemData:", self.list.FindItemData(-1, 11)
 
     def OnPopupTwo(self, event):
         self.log.WriteText("Popup two\n")