Creating a Tree Control

LabVIEW 2018 Help

Edition Date: March 2018
Part Number: 371361R-01
View Product Info

DOWNLOAD (Windows Only)

LabVIEW 2016 Help
LabVIEW 2017 Help
LabVIEW 2018 Help
LabVIEW 2019 Help
LabVIEW 2020 Help

Use the tree control to give users a hierarchical list of items from which to select. You organize the items you enter in the tree control into groups of items, or nodes.

Complete the following steps to create a tree control.

  1. Add a tree control to the front panel.

  2. Use the Labeling tool to enter an item name in the tree control and press the <Enter> key. LabVIEW creates a unique tag for the item. The default tag is the text in the first cell that contains text, starting from the left. If an existing tag already uses that string, LabVIEW appends a number to the string to create a unique tag for the new item. You use this tag to modify items or to gather information about items programmatically.
  3. Repeat step 2 for each item you want to enter. LabVIEW creates each new item at the same hierarchical level as the item above it. If there is no item above the new item, LabVIEW creates the item at the topmost hierarchical level.
  4. Set the hierarchy of the items in the tree control by indenting items.
  5. (Optional) Configure the tree control. You can add symbols and edit, disable, and delete items in a tree control. You also can set the expand/contract symbol type, case sensitivity, and item dragging for a tree control.
  6. (Optional) Set the number of items a user can select in the tree control.
  7. Create a Case structure to handle the selected item. A tree control with a selection mode set to 0 or 1 Item or to 1 Item appears on the block diagram as a string. You can right-click a tree control on the front panel and select Selection Mode»Data Type from the shortcut menu to change the data type. The data value for a single-selection tree control is the unique tag of the currently selected option. If no item is selected, the value is an empty string.

    A tree control with a selection mode set to 0 or More Items or to 1 or More Items appears on the block diagram as an array of strings, where the value(s) in the array represent the currently selected item(s). If no item is selected, the value is an empty array.

You also can use the TreeControl methods to add items to a tree control programmatically.


Not Helpful