Dynamically populate tree
I need to make a tree load dynamically as it's expanded using some kind of AJAX-style interaction.
Ideally, I'd like to have some kind event function that is called when a tree node is expanded, from which I can return some kind of data structure that describes the contents of that node.
I've come so far as to realize that you can assign functions to the ItemText, ItemImage, ViewCount and ViewIndices properties on the tree, which allows some form of dynamicism.
However, I'm wondering if there's some way I can return the data structure in one go when a node is expanded, instead of having to somehow splice it up and make it available through these four functions on demand. Then I wouldn't have to store the structure in some kind of intermediary global variable when the node is expanded.
Also, what events are available on the tree? There's not a lot of examples showing the tree in action - nothing in the quickref as far as I can see.