Configuring a Connector Pane Using VI Scripting

Requires: VI Scripting

You can use VI Scripting to interact with the connector pane of a VI programmatically to accomplish any of the following tasks:

This topic highlights the first two tasks. Refer to the Connector Pane methods for more information about interacting with a connector pane programmatically.

What to Use

This VI Scripting task requires the following objects:

VI:Connector Pane:Reference ConnectorPane:Pattern ConnectorPane:Assign Control To Terminal Connector Pane Pattern Reference Example
 Add  Find
 Add  Find
 Add  Find
 Open example

What to Do

Before you start: Open the Add Terminals to Connector Pane VI in the labview\examples\Application Control\VI Scripting\Connector Pane directory for an example that illustrates each step of the following procedure.

 Open Example

Expand the procedure for more information about this specific example.

  1. Obtain a reference to the VI whose connector pane you want to inspect or modify.

    Example Details

    In the example, the scripting VI uses the Open VI Reference function to obtain a reference to a specific VI.

  2. Use the VI:Connector Pane:Reference property to obtain a reference to the connector pane of the VI.
  3. Determine the connector pane pattern you want the VI to have.

    Connector pane patterns are denoted by a pattern index between 4800 and 4835. By default, connector panes use pattern 4815.

    You can use one of the following approaches to identify which pattern index to use.

    Example Details

    In the example, the scripting VI enables the user to select the connector pane pattern at run time. Therefore, the scripting VI uses a control to determine the connector pane pattern.

    Note Note  Because the Connector Pane Pattern control accepts any integer, this example should check the value of that control to ensure that it is within the 4800..4835 range of acceptable pattern indexes. For simplicity, the example omits this step.
  4. Use the Connector Pane:Pattern property to set the connector pane to your chosen pattern.
  5. Obtain references to the controls that you want to assign to connector pane terminals.

    Example Details

    In the example, the scripting VI uses the Panel:Controls[] property of the front panel of the target VI to obtain references to all front panel controls.

  6. Determine how you want to map these controls to the connector pane terminals.

    Refer to the LabVIEW Style Checklist for guidelines about assigning controls and indicators to connector panes that are visible to your users.

    Example Details

    In the example, the only goal of the scripting VI is to assign all controls to a terminal. Therefore, the scripting VI does not have criteria for how to map the controls to the terminals.

  7. Use the ConnectorPane:Assign Control To Terminal method to assign each control to the desired terminal of the connector pane.

    To identify the terminal index that corresponds to each terminal in your chosen pattern, refer to the Connector Pane Pattern Reference VI mentioned in step 3.

    Example Details

    In the example, the scripting VI iterates across the entire Panel:Controls[] array, assigning each control to the next terminal index of the connector pane. This approach does not require knowledge of specific terminal indexes because the scripting goal does not require the controls to be wired to the connector pane in a specific way.

    Note Note  Because it is possible in the example for the chosen connector pane pattern to have fewer terminals than there are controls on the front panel, it is also possible for the ConnectorPane:Assign Control To Terminal method to return an error. Refer to the Caveats and Recommendations section of this topic for information about avoiding this error.
  8. Use the Close Reference function to close each open object reference when you are finished using it.

    Example Details

    In the example, the scripting VI closes the reference to the front panel, the controls, the connector pane, and the target VI.

Caveats and Recommendations