LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Control Reference From Connector Pane

Solved!
Go to solution

I am trying to get a reference to a control associated with a specific index on the connector pane. I see that there is a method to assign a control to a terminal but not get control from a specific terminal. I know I can list all controls on the connector pane, but this doesn't tell me specifically where they are.

 

Edit: I see there are private methods for getting and setting properties which may have this info, but because these are undocumented and they are properties of a VI which is binary, I can't reverse engineer.

Message 1 of 8
(4,932 Views)

Greg,

 

If you have VI Scripting enabled you can open a reference to your VI, use a property node to get a reference to the connector pane and then another property node to get an array of all references to each terminal (terminals with nothing connected will still return a reference).  You can also find the pattern used for the connector in the same property node so there should be some way to get the reference to a specific connection.

 

To be honest, I have no idea how exactly the 1D array of control references maps to the connector pane, you will need to mess around with that for a bit.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 8
(4,916 Views)
Solution
Accepted by topic author GregFreeman

When you read the Controls[] property of the ConnectorPane class, it returns them to you in the terminal order. There's a VI in the examples folder that shows you (visually) the order for each connector pane pattern. I don't have LabVIEW in front of me at the moment, but it should be examples\Application Control\VI Scripting\Connector Pane, or something like that.

Message 3 of 8
(4,914 Views)

I think the Nth element in the control array from the connector pane is at index N on the connector pane.

Connnector Pane.png

 

0 Kudos
Message 4 of 8
(4,909 Views)

@Darren wrote:

When you read the Controls[] property of the ConnectorPane class, it returns them to you in the terminal order. There's a VI in the examples folder that shows you (visually) the order for each connector pane pattern. I don't have LabVIEW in front of me at the moment, but it should be examples\Application Control\VI Scripting\Connector Pane, or something like that.


 

Darren,

 

I found this and came back to post my findings but saw your answer. The disconnect I had was that the array of controls that the connector pane property node will return has null refnums for unwired terminals, but there are still references for every terminal on the pane. I assumed it only returned an array that was the size of the number of controls that were on the conn pane itself. Guess I should have checked first. What I can do now is get a reference to my control on the FP, list all controls on the connector pane, and search 1D array to get the index.

0 Kudos
Message 5 of 8
(4,898 Views)

Darren,

 

Good find on the example VI, it is very interesting and something that I did not know about.  The VI is called Connector Pane Pattern Reference.vi and is found under Programmatically Controlling VIs > Editing and Inspecting VIs (VI Scripting).

Matt J | National Instruments | CLA
0 Kudos
Message 6 of 8
(4,880 Views)

@GregFreeman wrote:
The disconnect I had was that the array of controls that the connector pane property node will return has null refnums for unwired terminals, but there are still references for every terminal on the pane.

For learning about the terminals on an object, a good tactic is to drop the object on a diagram and select Visible Items > Terminals:

 

terms.png

 

If you see completely enclosed terminal rects (like in the subVI terminals), then reading the "Terminals[]" property of the object will return all of them, even the null data type ones. So for the subVI, you can see that there are 12 distinct terminal rects, so that's how many terminals the object has. But on the built-in function, there are only 6 enclosed terminal rects. So reading the "Terminals[]" property on the subVI will return 12 items, and reading it on the function will return 6.

 


@Jacobson-ni wrote:
Good find on the example VI...

 

I wrote it (along with about 400 other VIs in the examples folder), so it was pretty easy to find. 😉

Message 7 of 8
(4,854 Views)

Thanks Greg.  I want to ask the same question. Kudos.

George Zou
0 Kudos
Message 8 of 8
(4,794 Views)