Showing results for 
Search instead for 
Did you mean: 

How to get access to Row Data (Child Text) in a Tree Control Pragmatically?

Go to solution

In LabVIEW 2010, I have entered Row Data into a Tree Control pragmatically using the Add Item method and providing the Child Text array and the Child Tag for the Row. When a Row in the Tree Control is selected, I can get the Row Tag in the Value Property of the Tree. But how do I access the Child Text array data when the Row is selected? I can't seem to find a Tree Control Property or Method that will return that data back again.


What I am trying to do is: once a Row in a Tree is selected and a button is pushed, if the Row Tag is valid, I want to transfer all of the Row data into another similarly formatted Tree. To do that I need the Row Data for the Tree and Row that was selected. I can not find a way to get access to this Row Data after it has been entered into the Tree.


Can anyone tell me how to pragmatically access the Child Text or Row Data in a Tree Control from a selected Row in the Tree? I have the Tag for the Row, but how do I access the data?


Thanks for your assistance.

0 Kudos
Message 1 of 5
Accepted by topic author dbaechtel

Looking through many examples, I found how to do this using properties ActiveItemRow and ActiveColNum, but I can find these properties documented anywhere in the LabVIEW Help. Even the Search through Help failed to turn up anything on them.


Where are these important parameters documented?

Why don't they appear in the Help?

Is there other ways to get access to Row Data (Child Text) form a selected Row in a Tree Control?

Message 2 of 5

I seem to be having the same issue. I am using the Point To Row Column method inside of a "Tree": Drop event to get the tag-column pair. I can get the source tag's data from the Get Drag Drop Data cluster; however, I can't seem to be able to get the destination tag's data. I have the destination tag name from the tag-column pair, but I can't turn that into a Row so I can use the Active Cell:String property to get the row's data. The Active Column Number and Row Number properties don't update to anything useful during drag and drop, so I can't just pull the data out automatically. Why isn't there just a method to get the 'item strings' of a tag like there is in the Get Drag Drop Data LV_TREE_ITEMS cluster?? Or at least why isn't there a method to get the current row number of a tag (since I realize it could change with the expand/collapse of parent items)??


Am I doing this wrong or is the tree control really this hard to use?



"Computers are useless. They can only give you answers." - Pablo Picasso
0 Kudos
Message 4 of 5

As mentioned in the posting here, you can use the Active Item:Tag property to set the item to which subsequent property changes apply. This includes pulling the Active Cell:String values out in a for loop as you increment the Active Cell:Active Column Number to get the row's Child Text data programmatically as I was originally wanting to do.


Note that wiring a 0 to the ActiveColNum property and reading the String value will return the tree item's visible name (in column 0), but not the unique item Tag (which is somewhat intangible after its creation). Therefore, I save the unique item tag when I add the item to the tree control (the output of the Add Item invoke node) and store it as a separate column of the Child Text array and place it out of sight in the tree control so I have access to it later. It might be useful, it might not.


I find the tree control totally non-intuitive and not well explained anywhere, but that's how a lot of LabVIEW coding is I guess. Play with it long enough and you become an expert. I had to learn the hard way, but I hope this helps someone else.



"Computers are useless. They can only give you answers." - Pablo Picasso
Message 5 of 5