Control References
Background
Until the release of LabVIEW 6i, there was no way of encapsulating the user interface portion of code when doing user interface programming. In previous versions of LabVIEW, user interface programming was done by using attribute nodes. Attribute nodes have implicit links to front panel controls and must reside in the block diagram of the same VI as their associated control. Therefore, if you have a VI that manipulates front panel controls extensively, your block diagram will end up with dozens of attribute nodes taking up a lot of space on the block diagram, making the block diagram cluttered and difficult to read. One of the keys to creating good LabVIEW applications is using the hierarchical nature of the VI. Creating modular programs using subVIs makes applications easy to debug, understand, and maintain. Until the release of LabVIEW 6i, there was no way to apply this same modular approach for user interface programming. The introduction of control references alleviates this problem.
Benefits
Control references have many benefits. They allow:
- Decoupling the front panel from the diagram.
- Moving complex UI code into sub-vi’s.
- Creation of truly reusable generic subVIs
Basic Usage
There are two types of control references, constants and controls.
Constant
To create a control reference constant for a control, right-click the control and select Create»Reference. A constant with a curved arrow appears on the block diagram. If you have multiple control reference constants for the same control, they all return the same reference. References returned from control reference constants do not need to be closed by the Close LabVIEW Object Reference function. A reference returned from a control reference constant is always strict.
