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.

Example Code

Programmatically Populate a Tree Control

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview:

This VI shows how to programmatically populate a tree control using the Edit Tree Items.Add Item invoke node.

 

 

Description:

It will create a parent item, a child to that parent and a grandchild to the parent.  This example also shows the difference between the "Left Cell String", "Child Text" and "Child Tag" inputs of this invoke node.

 

 

Requirements:

LabVIEW 2012 (or compatible)

 

 

Steps to Implement or Execute Code:

  1. Open the VI "Programmatically Populate Tree Control.vi"
  2. Run the VI

 

 

Additional Information or References:

Front Panel:

FP.PNG

 

Block Diagram:

BD.PNG

Notes:

By calling the Edit Tree Items.Delete Invoke node with the Tag input unwired, LabVIEW will delete all items in the tree control.

If you do not wire the "Parent Tag" input or wire to it an empty string constant, this will create a top level item.  This is what is done in the first "Edit Tree Items.Add Item" invoke node.

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
HunterSeeker
Member
Member
on

Could You include an image of your front panel so we can see what the tree control looks like?

David_L
Active Participant
Active Participant
on

Consider it done...

joshuatree
Member
Member
on

you should check out this tree toolkit on LAVA...

http://lavag.org/index.php?app=downloads&showfile=27

Taronmnats
Member
Member
on

Thanks that was helpful