I've wondered how to keep track of all items in a large tree view control. my program needs to be able to save information about all items of a tree view control and restore this tree view control by loading this information and creating the tree view with it's items.
now, since i won't know how many "levels" this tree view will have, how can i do a loop to enumerate really ALL items?
I'd have to start at the root, enum all child items of the root. But since these child items could possibly all have child items again, i'd have to enum all these child items as well and look for further child items of these new child items again. so there can be a lot of "child levels" to enumerate.
But there is no function to get the handle of the "real next" item. By real next, i mean not the next sibling item. If the item has child items, the next "real item" would be the next child item. if it doesn't have child items, the "real next" item would be the next sibling item. if the item is the last child item of an item and if this item doesn't have child items itself, the "real next" item would be the next sibling item of the parent item.
i hope you understand what i mean and what my problem is. i couldn't explain it better :(

Is there a way of coding a loop, which is able to enumerate all items or will i have to do the following:
Everytime i create an item I add it's handle to an array which contains all these item handles and use this array later to save information about each item?
Since i don't want to unnecessarily "waste" memory, i wouldn't like to save all item handles in an array.
i'd like to enum all items when i have to save the information and that's it. but if this is not possible, i'll probably have to save all these handles.
Posted on 2002-01-28 14:11:18 by darester
Hi darester

Have a look at the included RadASM project. Although I do the oposit of what you need (saving a nodes parent instead of next item) it can easily be reversed.

Posted on 2002-01-29 09:01:20 by KetilO