To download NI software, including the products shown below, visit ni.com/downloads.
Overview: This VI shows one way to organize the block diagram when attempting to set properties for multiple controls. It does so via creating an array of references and then modifying them in an indexed for loop.
Description: When attempting to access various controls and set their properties programmatically, it is possible to have a large amount of wires running through the block diagram. This example creates a set of references and adds them to an array. By indexing a for loop and passing those references to the input of a property node, the visible property is toggled with the click of the Test1 or Test2 buttons.
When the user clicks on the Test1 or Test2 control, the VI creates an array of eight elements of true or false values depending on the current value of the aforementioned control. This array is then completed by adding the current values of the controls that will not be changed. Finally, the last for loop updates all controls with their due value; either leaves them as is or modifies them accordingly.
While this VI simply toggles the visible property, within that for loop any other property of the control can be modified. Alternatively, instead of creating an array of references, it is possible to cluster them; it would not allow for an auto-indexing for loop, however.
Requirements: LabVIEW 2012 (or compatible). Hardware: none.
Steps to Execute Code:
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.