Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Controlling Front Panel Objects Programmatically from a SubVI

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Complete the following steps to pass a control reference to a subVI and use it to modify properties or methods of the referenced control or indicator.

  1. Right-click the front panel control or indicator of the main VI to which you want to create a reference and select Create»Reference from the shortcut menu. LabVIEW attaches a strictly typed control reference to the mouse cursor. Drop the reference on the block diagram of the main VI.

    You also can create a control reference by selecting a control refnum on the Controls palette, adding it to the front panel of the subVI, and adding an object of the same type as the referenced object to the front panel control refnum shell. This creates a non-strictly typed control reference.
  2. Open the subVI, or create a new VI, to which you are passing the control reference. From the block diagram of the main VI, drag the control reference to the front panel of the subVI to create a control refnum control for the control reference on the subVI front panel. A corresponding control reference terminal appears on the subVI block diagram.
Note  If you drag the control reference to the block diagram, you only copy the control and control reference rather than create a control refnum control.
  1. Complete the following steps to modify properties or methods of the front panel object associated with the control reference by creating a Property Node or Invoke Node.
    1. Right-click the control reference on the block diagram of the VI.
    2. Select Create»Property for (type name) or Create»Method for (type name) and select a property or method from the shortcut menus.
    3. Click to place the node on the block diagram of the subVI.
    4. Wire the control reference to the reference terminal of the Property Node or Invoke Node. The Property Node or Invoke Node references the control in the main VI.
    You also can select a Property Node or Invoke Node on the Functions palette and place it on the block diagram. Right-click the node and select a property or method from the Properties or Methods shortcut menus.
  2. Set up the terminals on the connector pane of the subVI, including the control reference.
  3. On the main VI, add the subVI to the block diagram and wire the control reference to the control reference terminal of the subVI.

Refer to the Control References VI in the labview\examples\Application Control\VI Server\Control References directory for an example of controlling front panel objects programmatically from a subVI.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit