LabVIEW - Creating a Tree Control
We can use the tree control to give users a hierarchical list of items from which to select. We organize the items we enter in the tree control into groups of items, or nodes.
Follow these steps to create a tree control.
Add a tree control to the front panel.
We can 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. We use this tag to modify items or to gather information about items programmatically.
Repeat previous steps for each item we 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.
We can configure the tree control. We can add symbols and edit, disable, and delete items in a tree control. We can also set the expand/contract symbol type, case sensitivity, and item dragging for a tree control.
We can set the number of items a user can select in the tree control.
We can 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. We 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.
We can also use the TreeControl methods to add items to a tree control programmatically.
Watch the entire LabVIEW tutorial series here;
• NI LabVIEW - How to Use View Menu?
Watch the entire TestStand video learning series here;
• NI TestStand Documentation and Resources
Get more LabVIEW Tutorials for free!!!
/ @rashidmalik-labview
#labview #labviewtutorial #labviewListboxesTablesTreeControls