Hi all,
Need to save the contents of a wxTreeCtrl. I am more interested in any ideas anyone might have than how to implement them.
My best idea is to have a recursive function, which you would call on the root item and would go something like this:
(it takes a wxTreeItem as an argument, and returns a list)
iterate through the items children:
if the chlid has his own children, call it on the child.
if not add the child's text as an item to the list.
return a list containing the item's text as the first element, and the list as the second.
That would give us a list of all the items with an items children in a nested list after it. Loading from a list like that is rather simple too, what I'm thinking about is what
format is the best one to save it to a file (which would be easy to read too)? Maybe just write the list as it is; even though I can't think of any other (simple) way, that way seems very crude to me!
If anyone has any comments/ideas/suggestions, I would like to hear them.