08-26-2011 02:49 AM
I'm using a tree control to dynamically access one of several objects. I am able to save these objects to file and load them back in to my application which automatically adds an item to the tree that is referenced to that object. One of the properties of the object is an "Expanded?" flag that specifies whether the item should be expanded in the tree control.
When loading a large set of items and populating the tree control, it's best to use the "Add Multiple Items to End" method. If I add items one at a time, the populating of tree items is visibly slow, so adding multiple items at once is the right method to use. The input to this method is an array of tree item clusters. The cluster has the following properties:
By passing all these properties to the "Add Multiple Items to End" method, I can load those items in to the tree along with their settings instantly. One item that is missing from this cluster is an "Expanded" flag. In order to then set the expanded property of the tree items, I have to loop through the items and invoke the "Open/Close" method one item at a time. This is a slow process and is visible to the user.
Is there a faster way?
Solved! Go to Solution.
08-26-2011 06:54 AM - edited 08-26-2011 06:54 AM
Adding one element at time or looping throught all the elements of the tree is (a lot) faster if you defer the panel update before doing it and the restore it after.
Look here, for example: https://decibel.ni.com/content/docs/DOC-4519
M