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.
This VI Scripting task requires the following objects:
|VI:Connector Pane:Reference||ConnectorPane:Pattern||ConnectorPane:Assign Control To Terminal||Connector Pane Pattern Reference Example|
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.
Expand the procedure for more information about this specific example.
In the example, the scripting VI uses the Open VI Reference function to obtain a reference to a specific VI.
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.
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 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.|
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.
Refer to the LabVIEW Style Checklist for guidelines about assigning controls and indicators to connector panes that are visible to your users.
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.
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.
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 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.|
In the example, the scripting VI closes the reference to the front panel, the controls, the connector pane, and the target VI.