Example Code

Determining the Data Type of all Front Panel Controls & Indicators Programmatically Using LabVIEW

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 example demonstrates how to retrieve the data type of all front panel objects through the use of VI Server, Property Nodes & Scripting Property Nodes. 


Description
LabVIEW has no direct way for determining the data types of the objects on the Front Panel, this example scans through the Front Panel Objects and returns their datatype to an output array. The output array is ordered based on the control index of the Front Panel Object.

It does this by analyzing the general class name for the object, and then determining whether further evaluation is required. For e.g. an object with the class name of Boolean could be put straight into the array; However an object with the class name of Array would require further investigation to determine the representation of the elements in the array.

For determining the exact type of numeric/refnum/cluster etc., a variety of Scripting property nodes, standard property nodes and lookup tables are used where required.

While most data types are relatively straight forward to determine through this method of searching for representations or checking lookup tables, it is worth noting that clusters require a recursive method due to the ability to place clusters within clusters.

All of the code is documented; However if anything is unclear (or errors are spotted), feel free to comment and I'll be happy to discuss it further.

 

Requirements

  • LabVIEW 2012 (or compatible)

Steps to Implement or Execute Code

  1. Download and extract the attached Zip File
  2. Open the "Get Front Panel Object Types" project from the Front Panel Object Types Folder
  3. Open "Get Front Panel Object Types 2012 NIVerified.vi"
  4. Run the VI
  5. The VI will launch a file browser dialog, select the VI of your choice, or select the example front panel included in the project "Test Front Panel.vi"
  6. The code will run and populate the array with the Front Panel Object Types. These can be compared to the selected VI, remembering that the array is populated based on the index of the front panel control.

 Additional Information or References
 

 

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

 

 

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

Comments
Active Participant
Active Participant
on

This says it is for front panel "objects" but it is really for front panel "controls" (and indicators).

Decorations, comments and other non-control front panel objects are ignored.

Member
Member
on

Good point - updating now

Member
Member
on

Hi,

I can't open this .zip with LABView 2012. Could you release a new version ?

Thanks

Vincent