[wxPython] wxTreeCtrl

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] wxTreeCtrl

Paul Robinson-14

I can't seem to find any reference to double click events on TreeCtrls.
Is this because, by default, double clicking expands the branch?
The nodes I would like to have this event on do not have children (at
this point - see below) and so no expand event is produced either!

In the application I'm working on I would like build and add to a tree
progressively. Double clicking a tree node should retrieve an XML
document that will relate to the clicked node and expand that node with
it's children (depending on whether the XML describes these children or
not).

Does anyone have any suggestions?

Context: (In case you were wondering)
At startup, the application retrieves XML that describes the "root"
level of a hierarchy. This is then added to by retrieving additional
XML. The tree structure is "cached" in the structure of the TreeCtrl.
Retrieving an XML description of the entire tree could be potentially
huge, hence this way of doing things.

Thanks,
        Paul.

_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxTreeCtrl

Robin Dunn
>
> I can't seem to find any reference to double click events on TreeCtrls.
> Is this because, by default, double clicking expands the branch?
> The nodes I would like to have this event on do not have children (at
> this point - see below) and so no expand event is produced either!
>

Take a look at the demo.  Since a wxTreeCtrl is a wxWindow, you can catch
lower level events like mouse clicks and such.  The only problem is that
since it is lower level the event doesn't know about tree items.  To find
the item the double click happened on you can get the poisition of the click
and use wxTreeCtrl.HitTest.



--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users