From: Ade <sk...@bl...> - 2006-09-19 19:51:56
|
Thanks for the info, Jussi. From your text i went through the wx documentation for TreeControl (i hadn't even thought of thw wx stuff) I found that the thing I was looking in my blinkered way after some trial and error was the tree.SetPyDataItem and tree.GetPyDataItem. This means that each node in the tree can be associated with an element in, say, a list which is the real data I want to get returned. I like your way by kind of recursing back to the root getting all the text of all the branches between the node selected and the root. Thank you very much :) Adrian From: Jussi Salmela <jussi.salmela@pp...> Re: Tree control 2006-09-17 06:12 This is for Ade to answer the question on Sep 11, 2006 No-one has answered your question. I don't know if it is because they thought you should be able to figure out yourself. After investigating your problem, I at least think so because it took me under a hour from the problem to the solution and I've never used the treecontrol nor looked at its demos nor the souce code nor the documentation. Here's what I did and what I think you should have done also: 1. I looked at the Pythoncard treecontrol demo and its source code. The events handled by PythonCard are listed at the beginning of the minimaltree code 2. I looked at the wxPython demo finding the treecontrol demo, running it and browsing its source code. I found out that the event generated by clicking the item text is OnSelChanged. 3. But your original headache was how to find the path to the root. Well I had the third and last help item left: wxWidgets documentation. There I browsed the wxTreeCtrl documentation looking for something with Parent in it. Found GetParent with a note to use GetItemParent instead. 4. Copied the minimaltree example to my own directory and started modifying and debuggin it to get what I/you wanted. Copied the on_tree_itemExpanding method and modified it to become (after 3-4 iterations): code <snip> I think this is near enough the thing you wanted, isn't it? About SourceForge.net About OSTG Privacy Statement Terms of Use Advertise Get Support RSS Powered by the SourceForge® collaborative development environment from VA Software ©Copyright 2006 - OSTG Open Source Technology Group, All Rights Reserved -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ |