]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/TreeListCtrl.py
use wxString in wxRegKey methods; make it compile without implicit wxString->char...
[wxWidgets.git] / wxPython / demo / TreeListCtrl.py
index de7fe1b11dd5df0dd7c0ee8008d60c57e75972ed..65013924377a0b98d8aa4aa331288d0d7f9ca09a 100644 (file)
@@ -12,16 +12,21 @@ class TestPanel(wx.Panel):
         wx.Panel.__init__(self, parent, -1)
         self.Bind(wx.EVT_SIZE, self.OnSize)
 
-        self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE
-                                   #| wx.TR_ROW_LINES
-                                   #| wx.TR_NO_LINES 
-                                   #| wx.TR_TWIST_BUTTONS
+        self.tree = gizmos.TreeListCtrl(self, -1, style =
+                                        wx.TR_DEFAULT_STYLE
+                                        #| wx.TR_HAS_BUTTONS
+                                        #| wx.TR_TWIST_BUTTONS
+                                        #| wx.TR_ROW_LINES
+                                        #| wx.TR_COLUMN_LINES
+                                        #| wx.TR_NO_LINES 
+                                        | wx.TR_FULL_ROW_HIGHLIGHT
                                    )
+
         isz = (16,16)
         il = wx.ImageList(isz[0], isz[1])
         fldridx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,      wx.ART_OTHER, isz))
         fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN,   wx.ART_OTHER, isz))
-        fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz))
+        fileidx     = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz))
         smileidx    = il.Add(images.getSmilesBitmap())
 
         self.tree.SetImageList(il)
@@ -70,20 +75,19 @@ class TestPanel(wx.Panel):
         self.tree.Expand(self.root)
 
         self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
+        self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate)
+
 
+    def OnActivate(self, evt):
+        self.log.write('OnActivate: %s' % self.tree.GetItemText(evt.GetItem()))
+        
 
     def OnRightUp(self, evt):
-        # Convert the position from being relative to the subwindow to
-        # being relative to the outer treelist window so HitTest will
-        # have the point it is expecting.
         pos = evt.GetPosition()
-        pos = self.tree.GetMainWindow().ClientToScreen(pos)
-        pos = self.tree.ScreenToClient(pos)
         item, flags, col = self.tree.HitTest(pos)
-
         if item:
-            print flags, col, self.tree.GetItemText(item, col)
-
+            self.log.write('Flags: %s, Col:%s, Text: %s' %
+                           (flags, col, self.tree.GetItemText(item, col)))
 
     def OnSize(self, evt):
         self.tree.SetSize(self.GetSize())