Showing results for 
Search instead for 
Did you mean: 

Question regarding accessing Treeview folder content


Hi All ,


I am using a tree view control for populating my directory structure which may contain some sub folders and some files.

Want i want to do is, I want to select particular item/items from tree view and add it to different list(on clicking add button).

If i select only single file(chile element in tree view) it should get added to list.

But if I am selecting folder from tree view(parent item) all the files inside that folder should get added to the list.


I am not able to acheive last functionality. I am not able to identify whether the selected item from tree view is child or parent? Is there any property for that..I tried with properties like get parent , get child but its not working...Smiley Sad


Am i doing it correctly? Can someone help me in this?

Thanks in advance


0 Kudos
Message 1 of 5

When you say 'tree view control' is it a normal tree control on the control palette?


If so, this is what I do. Other people may have a different idea.



When you populate the tree, simply create an array of all tags that exist within the tree. Use {File/Folder Type};{Path} as a Tag Value of a tree element. For example, C:\test.txt becomes "File;C:\test.txt". C;\Users\Name becomes "Folder;C:\Users\Name"



If a selected value begins with 'File', then you can simply add the remaining value to the list.


If a selected value begins with 'Folder', then loop through the array to look for elements that start with 'File' and also includes the selected folder path within its file path. Then you can tell all files within the folder. This way you don't have to look at the tree properties or methods for children or parents.


Hope it helps.

Certified LabVIEW Architect 2013
0 Kudos
Message 2 of 5

This means first we have to edit the tagnames as per file and foler and then depending on the selection we can check whether file is selected or folder is selected?

I was thinking there could be a method/property to identify what the item is whether parent /child?


Thanks for the reply. Smiley Happy


0 Kudos
Message 3 of 5

Can you explain how you currently populate the tree more in detail? What do you use as a tag value?

Certified LabVIEW Architect 2013
0 Kudos
Message 4 of 5



Currently I am using path of the folder/file as the tag value while populating the tree.

For eg: if folder is in c drive tag would be C:\folder name .


What I understood from above reply is while populating only i have to add differentiation for file and folder along with the path and then add it to the tag value.When the item is selected , check its tag and identify whether it is file or folder.



0 Kudos
Message 5 of 5