LabVIEW 2018 Help
View Product Info
DOWNLOAD (Windows Only)
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.
- Add a tree control to the front panel.
- 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.
- 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.
- Set the hierarchy of the items in the tree control by indenting items.
- (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.
- (Optional) Set the number of items a user can select in the tree control.
- 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.