I am still trying to wrap my brain around the complexity of a treeview, and how to gain the fullest benefit from this kind of control. Earlier, when asking, one of you send me a code snip-it from one of his apps, holding some 600 lines. Thanks to you, and it got me somehow going. Yet, I don't follow all of your thinking, or the reason why you do this and that. That is one of the drawbacks of 600 lines of coding. Smile.
Allright, I have got that far, that I am able to fill in the information on the tree, and get it displayed in my dialog. So far, this works satisfactory. Now, I am stuck with a few challenges, most of all when comes to retrieve the needed information from the treeview. I have a feeling, most of my getting stuck here, is due to a lack of understanding. That's why, I hoped to have some clarification on the following questions. 1. What is the exact benefit of the Text, as compared to the Data, field in a treeview item. OK, I do get the fact, that in case the same text could happen to be on several branches or leaves of the tree, the Data field could be used to distinguish the one occurrance from the other. But if i have a tree, where no text will appear more than once, is there any reason why I should bother about filling in the data field for each item? I.e, would there be any search feature or the like, that could be quicker done by iterating the tree-structure on the Data fields, compared to simply just concentrating on the Text fields. 2. The treeview I am building, has checkboxes, which the user can check for each item on the tree. I have searched the Reference manual, but not sure if I have overlooked anything. From what I can see, there is no way in determining whether a treeview Item has been checked or not. I see the Selected feature, but from what my testing leads me to understand, this simply let's me know when an item has focus (that is, when the cursor is placed on the item, the Selected feature will be set). Is it correct, that there is no build-in feature, that would "fire", when a treeview item has been checked or unchecked? If this is the case, technically, why? We have features for Checkboxes, which will tell us when it is checked and not - and we have similar features for a multi-selection listbox. Why would there be no feature set, whenever a treeview item is checked? 3. Does anyone have a simple quick iteration routine, for "rushing" through a whole treeview, including all its branches and leaves. My treeview, might hold as much as 9 sublevels, in addition to the root. And it might hold different amounts of entries on each branch or sublevel. I guess the best would be to use some For...Next loops, and somehow retrieve the Count property for each branch. But I have run my head into the wall, as to how to get through absolutely all the possible items on the tree. I guess, that is the one way to go, when iterating the different items, or am I totally lost in such an approach? Say for instance, the user would have been given the chance of searching for a given text, which would be the Text property of an item on the tree. I then guess, I will have to iterate all the current items on the tree, looking out for that particular text. And, that is why, I wondered if there was a simple routine, that would perform such a "run-through", with relatively few lines of coding. Yep, I did read through I don't know how many pages, in the Reference manual, and I have been looking through quite a few lines of existing coding. I am sure, I can get on with this, if only I can wrap myself around a few corners. So, anyone who has the urge to help me on getting those pieces of information straightend out, thanks to you, as it surely will help me crawling my way further on. :) Only hope my questions were clearly enough stated, that you will be able to give me the right push. :)
