wxTreeCtrl left click event

Hi,

I used a wxTreeCtrl and I didn't found the way to handler a left
click event. The doc shows *EVT_TREE_ITEM_RIGHT_CLICK* event and
*EVT_TREE_SEL_CHANGED* but no left click event... I actually used
*EVT_TREE_SEL_CHANGED* but the handler is called even if it is not
a mouse event.

How can I do to handle a left click event or to know if it is a mouse event
when using *EVT_TREE_SEL_CHANGED* ?

Thanks.

Olivier

Hi Olivier,

Hi,

I used a wxTreeCtrl and I didn't found the way to handler a left
click event. The doc shows *EVT_TREE_ITEM_RIGHT_CLICK* event and
*EVT_TREE_SEL_CHANGED* but no left click event... I actually used
*EVT_TREE_SEL_CHANGED* but the handler is called even if it is not
a mouse event.

How can I do to handle a left click event or to know if it is a mouse event
when using *EVT_TREE_SEL_CHANGED* ?

Try with wx.EVT_LET_DOWN, with something like this:

def OnLeftDown(self, event):
        pt = event.GetPosition();
        item, flags = yourTree.HitTest(pt)

        if not item:
            # no item hit
            return

        # do whatever you want with the item

HTH.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

ยทยทยท

On Jan 22, 2008 11:50 AM, Olivier Ravard wrote: