Hi all,
i've a problem with that widget. I need to catch a double-click on items
inside that tree but seems that i'm only able to catch dclicks into parent
folder. Here's my code (cleaned from unneeded things):
...
self.window_2 = gizmos.TreeListCtrl(self, -1,style = wx.TR_DEFAULT_STYLE |
wx.TR_FULL_ROW_HIGHLIGHT)
...
isz = (16, 16)
il = wx.ImageList(isz[0], isz[1])
self.fldridx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER,
wx.ART_OTHER, isz))
self.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN,
wx.ART_OTHER, isz))
self.fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW,
wx.ART_OTHER, isz))
...
self.window_2.SetImageList(il)
...
self.il = il
...
self.window_2.AddColumn(" ")
...
self.window_2.SetColumnWidth(4,150)
...
self.window_2.GetMainWindow().Bind(wx.EVT_LEFT_DCLICK,self.LISTA_OnClick)
...
self.LIST_Update()
def LIST_Update(self):
# ROOT
self.classRoot = self.window_2.AddRoot(d["NAME"])
self.window_2.SetPyData(self.classRoot,d)
self.window_2.SetItemImage(self.classRoot, self.fldridx, which =
wx.TreeItemIcon_Normal)
self.window_2.SetItemImage(self.classRoot, self.fldropenidx, which =
wx.TreeItemIcon_Expanded)
# SUBFOLDER
if d["CLASS"] == "LAVORO":
self.subClassRoot =
self.window_2.AppendItem(self.classRoot,date_start[2]+"-"+date_start[1]+"-"+date_start[0])
self.window_2.SetPyData(self.subClassRoot,d)
self.window_2.SetItemImage(self.subClassRoot, self.fldridx, which =
wx.TreeItemIcon_Normal)
self.window_2.SetItemImage(self.subClassRoot, self.fldropenidx, which =
wx.TreeItemIcon_Expanded)
# ITEM
if(d["CLASS"] == "EVENTO"):
self.classItem =
self.window_2.AppendItem(self.subClassRoot,date_start[2]+"-"+date_start[1]+"-"+date_start[0])
self.window_2.SetPyData(self.classItem,d)
self.window_2.SetItemText(self.classItem,date_start[3]+":"+date_start[4]+":"+date_start[5],1)
self.window_2.SetItemImage(self.classItem, self.fileidx, which =
wx.TreeItemIcon_Normal)
def LISTA_OnClick(self,evt):
pos = evt.GetPosition()
pos = self.window_2.GetMainWindow().ClientToScreen(pos)
pos = self.window_2.ScreenToClient(pos)
item, flags, col = self.window_2.HitTest(pos)
if item:
d = self.window_2.GetPyData(item)
if d["CLASS"] == "EVENTO":
Someone can help me please ?
Oz
···
--
----
O-Zone ! No (C) 2005
WEB @ http://www.zerozone.it
HOBBY @ http://peggy.altervista.org
Call me with FWD: 692329