From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read out the tags of a tree control in serial order.

I am trying to create a simple array representation of a tree that for each row : the level in the hierarchy and the text string of the element. I want to list this in sequential order (as it appears in the tree control when all elements are open). This seems simple enough; however, all the approaches I've tried have just come up short. I tried to read out the tags in sequential order by repeatedlyreading the first tag in the tree, deleting it until all the tags are gone (see attached VI) but so is the rest of the information about the tree. I couldn't figure out how to make a copy of an existing tree. If I could get a sequential lists of the tags, I would be all set.
0 Kudos
Message 1 of 4
(3,606 Views)
Hi

Here is a solution, which reads the items of a tree and writes them into an array in the order they are visible in the tree (top - down).

You have the main vi (Tree.vi) where a tree-control and an array-indicator are the only elements. On the diagram the vi GetChildren.vi is called. Be aware that this vi is in reentrant mode and can not be debugged. It reads the children of a parent node in a recursive way.

Hope it helps.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 2 of 4
(3,594 Views)
Thanks - this is exactly what I need.
Nice solution.
0 Kudos
Message 3 of 4
(3,589 Views)
Thanks - this is a big help.
0 Kudos
Message 4 of 4
(3,587 Views)