Programmatically Accessing Objects Within a Tab Control in LabVIEW

Updated Aug 28, 2023

Reported In

Software

  • LabVIEW

Issue Details

I am trying to get information from the front panel objects in a tab control with property nodes, however, when I try to create a property node I only get properties for the tab control, not for the objects within.

How can I programmatically access the controls or indicators inside the tab control?

Solution

Similar to the use of property nodes to control objects in the front panel, the objects within a tab control can be accessed with property nodes. The two methods below show different ways to do so.

Method 1: Using the tab control Pages property.

  1. Create a property node from the tab control by right-clicking it and selecting Create » Property Node. Then, select Pages from the drop down to access each page in the tab control.
  2. Use the Index Array VI to access a specific page in the tab control. The index input indicates the page you want to access (0 corresponds to the first page, 1 to the second page, and so on).
  3. Place a property node, connect the output from the Index Array VI to the reference input of the property node, and select CtlsOnPage from the drop down menu. This will access the controls in the page of the tab control.
  4. Use another property node inside of a for loop to index through the controls and access the selected property. In the example shown, the Label.Text property is used.
  5. Display or process the information from the property node.
Tab control property node method
 
Method 2: Using a VI server property node and control references.
  1. Place a property node, right-click it and select Select class»VI Server»VI»VI. Then select the Front Panel property from the drop down menu.
  2. Connect another property node to the previous one and select Controls [ ] from the drop down menu.
  3. Use the Index Array VI to specify the tab control from the available controls and indicators in the front panel. The index input indicates which control you want to access (0 corresponds to the first control placed on the front panel, 1 refers to the second control, and so on).
    • If you are unsure which index the tab control has, go to the toolbar at the top of the window and select Edit » Set Tabbing Order...; The number displayed for the tab control is its index number. Click the X on the toolbar to cancel and close the edit mode.
  4. With the To More Specific Class VI change the reference wire from a control to a tab control reference.
    • To create the tab control reference, you can right-click the To More Specific Class VI and select Create Control, right-click the newly created control and choose Select VI Server Class>>Generic>>GObject>>Control>>PageSelector>>TabControl.
  5. Place a property node with the tab control reference wire as its input and select Pages from the drop down menu.
  6. Access a specific page in the tab control using the Index Array VI. The index input indicates the page you want to access.
  7. Connect the output from the Index Array VI to another property node and select CtlsOnPage from the drop down menu.
  8. Use a property node inside of a for loop to index through the controls and access the selected property. In the example shown, the Label.Text property is used.
  9. Display or process the information from the property node.
VI server reference method.PNG
 

Additional Information

If you are using strictly typed references you need to make sure that the reference that is used for the property nodes matches the data type of the control reference, otherwise type mismatch errors can be reported. For example, a tab control with three pages would be considered different from a tab control with two pages.