Use the control refnum controls located on the Refnum and Classic Refnum palettes to pass front panel object references to other VIs. You also can right-click a front panel object and select Create»Reference from the shortcut menu to create a VI Server reference. Additionally, you can locate a front panel object from the VI Server reference constant on the block diagram. Right-click the reference on the block diagram and select Find Control from the shortcut menu. After you pass a VI Server reference to a subVI, use Property Nodes and Invoke Nodes to read and write properties and invoke methods of the referenced front panel object.
|Note Control references do not automatically keep a VI in memory and do not control whether or not a VI remains in memory. If a VI leaves memory, the control reference becomes invalid. To maintain a VI in memory when using a control reference, you can use the Open VI Reference function to retrieve the VI and use the Close Reference function to properly close the VI. You also can maintain a VI in memory by keeping the front panel of the VI open.|
You also can use events to control block diagram behavior programmatically through front panel objects.
Although you can use control references to pass data, you should read and write to the control itself or use local or global variables instead to improve performance.
Control references correspond to user interface object references in text-based programming languages. Control references do not correspond to pointers in text-based programming languages.
Refer to the Control References VI in the labview\examples\Application Control\VI Server\Control References directory for an example of using control references.
Strictly typed control refnums accept only control refnums of exactly the same data type. For example, if the type of a strictly typed control refnum is 32-bit integer slide, you can wire only a 32-bit integer slide to the control refnum terminal. You cannot wire an 8-bit integer slide, a double-precision scalar slide, or a cluster of 32-bit integer slides to the control refnum terminal.
Control references you create from a control are strictly typed by default. A red star in the lower left corner of the control reference on the front panel indicates the control reference is strictly typed. On the block diagram, (strict) appears on the Property Node or Invoke Node wired to the control reference terminal to indicate that the control reference is strictly typed.
|Note Because the latch mechanical actions are incompatible with strictly typed control references, Boolean controls with latch mechanical action produce weakly typed control references.|
Weakly typed control refnums are more flexible in the type of data they accept. For example, if the type of a weakly typed control reference is slide, you can wire a 32-bit integer slide, single-precision slide, or a cluster of 32-bit integer slides to the control reference terminal. If the type of a weakly typed control reference is control, you can wire a control reference of any type of control to the control reference terminal.
|Note When you wire a Property Node to a weakly typed control reference terminal, the Value property produces variant data, which might require conversion before you can use the data. The History Data property for charts is available only if the chart reference is strictly typed.|