Example Code

Programmatically Obtaining References of Controls Inside of Tab Controls and Clusters

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 examples shows how you can access all of the control references of controls inside of a tab control and a cluster.


Description:

When looking for references of controls on the front panel, a property node of the front panel will return an array of controls. This array of references needs to seperated in order to pull the specific properties of each control. I used an auto-index for loop to accomplish this task. In this specific example I am getting the labels of all of the controls and indicators and putting them in a 1D array. To make the code more readable, I have created subVI's that handle special cases like the tab control and the cluster. When you have a tab control or cluster, you now have controls within a control reference. Using property node again, you can pull out the array of references of the controls within these controls. These again are auto indexed to pull each control out individually.


Requirements:

NI LabVIEW 12.0 or compatible


Steps to Implement or Execute Code:

  1. Run the VI

FP.jpg

 

BD.jpg

 

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

 

 

National Instruments
Applications Engineer

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

Comments
fpdx
Member
Member
on

thanks, I added the Value of each control in a variant array, and it's useful way to take a snapshot of the current status of the vi.

mperss
Member
Member
on

Thank you for this, I can now handle all my references in a more simple way.

cubz
Member
Member
on

Hi,

thanks. I tried this with a cluster, the upper code does not work. I wonder if anyone knows why? What is the purpose of the "To more specific"?

referencesOfAllInsideCluster.png

Victor1978
Member
Member
on

The upper code in your example does not work because you need to go to a more specific control, i.e. a reference to "any kind of" cluster, and not specifically "your kind of" cluster.

Does the code from the original post (Cluster Ref.vi) work for you? If not, what error did you get?