What you are looking for is a "virtual tree view". As far as I am aware,
the vanilla tree view in Forms wasn't written to perform this (or anything
much come to think of it!).
The approach really depends on how many items are in the root of your tree
view. If you have literally thousands, populating the tree still shouldn't
take all that long (I've tested mine with a full tree of over 6,000 items
and ok, it takes a couple of seconds, but it isn't too annoying). The
issue is what you are doing in order to fetch a given item. For example, I
fetch my entire database tree into memory (in my own tree structure, not a
tree view), then I just go through the whole thing, adding nodes to the tree
view. Its quicker than fetching one item from the database, adding it to
the tree, going back and fetching the next etc.
Also, consider categorisation. Are you sure you need a tree this large?
Why not just populate the root with the 1st and 2nd level nodes and then
when the user clicks to open a node, populate that node with the 3rd level
and so on.
Just some ideas
pmcguire said:
I have a treeview with a lot of nodes. I want to load only the nodes that
are initially visible when the form loads, and then continue to populate it
in background and/or when the nodes are required by the user either
scrolling or performing some other action that would move the treeview
window to a particular "unloaded" node in the treeview.
Any advice on how to go about this? It seems I need a way of sensing a
scroll event in the treeview control, but it does not appear that the
treeview control exposes this event.