04-01-2020 05:43 AM
I have an application with several tree controls and I observed that populating some of them took quite some time. Since the code to update them was the same (it was different instances of a QControl), and the data that is written to the tree controls was read from a database I first thought that it was the API method for the database reading that was slow (which was also the case for some parts). But after I while I discovered that it was the updating of the control itself that was the main reason to the slow update. And it took some more time before I figured out that the problem was not in the code (e.g. with defer panel updates) but with the tree control itself, which I had to replace with a "fresh" copy of a tree control to get a reasonable update time.
The attached project contains a test VI which contains a functional tree control and a buggy one, these are populated with the same data but have very different update times, e.g. on my laptop I observed the following timings:
- "Functional" tree: ~700 ms (defer panel updates enabled), ~14 s (defer panel updates disabled)
- "Buggy" tree: ~25 s (defer panel updates enabled), ~40 s (defer panel updates disabled)
Is this a known behaviour? It's been reproduced on other computers than mine so it seems like a bug (which have caused me to spend several hours of troubleshooting). I have seen other reports on slow updating tree controls (e.g. https://forums.ni.com/t5/LabVIEW/defer-panel-updates-doesnt-work/td-p/2848054?profile.language=en), so maybe it's been there for a while.
04-01-2020 06:21 AM
Have you tried with "Add multiple items to end"?
04-01-2020 06:54 AM
So, a couple of tests:
If you copy the working control and replace the other one by selecting it and pasting, it's also fast.
I noticed the slow one had a different font setting, changing to the same made it slightly faster, but still far from each other.
Looking at all the differences as Multiple line input, Selection mode and others, none made a big difference.
For some reason the Expand/Contract symbol type is active on the right one whereas only the top row is active on the fast one, that's the only difference i could find.
The control seems corrupted somehow .