LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reference of a control from the reference of a vi

Hopefully there is a simple answer to this. I have a vi that returns it's reference and would like to know if there is a way to use the reference of the vi to obtain the reference of all the controls in the vi.
0 Kudos
Message 1 of 20
(3,908 Views)

Yes use a property node to get ref to the FP (fron panel) then use that ref for another prop node to get an array of refs to all controls on the FP. Each control has a name property that use can use to decide which is which.

 

Use "to more specific" if you need to get at the object specific properties.

 

Ben

 

 

PS This only counts as a race condition if your answer over-writes mine. Smiley Mad

Message Edited by Ben on 10-29-2009 02:27 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 20
(3,898 Views)

Your question sounds just like this one.

 

How can i get the reference to Controls from VI-reference

0 Kudos
Message 3 of 20
(3,897 Views)

Create a property node for the VI reference and select 'Front Panel', right-click and create a property node for the Panel Class and select 'Controls[]'

 

Edit:  I believe this counts as a race condition.

Message Edited by Darin.K on 10-29-2009 02:25 PM
Message 4 of 20
(3,897 Views)

"Create a property node for the VI reference and select 'Front Panel', right-click and create a property node for the Panel Class and select 'Controls[]' "

 

 

What is the best way to access the specific control that I want by name?

0 Kudos
Message 5 of 20
(3,887 Views)

Steve Block wrote:

"Create a property node for the VI reference and select 'Front Panel', right-click and create a property node for the Panel Class and select 'Controls[]' "

 

 

What is the best way to access the specific control that I want by name?


 

THis Nugget has a lot of hints for working with control refs.

 

here is a preview

 

 

Use the label to choose which ref you need.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 20
(3,881 Views)

As Ben noted, you can pull the name from the ctrl reference.  With the array of names, you can search for the one you are interested in to find its index in the Controls[] array.

 

GetControlRefs.png

Edit:  I am going to lunch now, Ben has this covered, and then some....

Message Edited by Darin.K on 10-29-2009 02:36 PM
0 Kudos
Message 7 of 20
(3,879 Views)
Darin.K s method works, however, I have a tabbed control with controls inside of the tabs. How do I now access the controls inside of the tab? Do I need to typecast the reference?
0 Kudos
Message 8 of 20
(3,871 Views)

See my Nugget to learn how to test if a ref is of a specific type but once you find a tab ref use it to feed another controls prop node to get the controls on the tab. Repeat for nested tabs.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 20
(3,865 Views)
So far so good. I just ran into another roadblock though. I have a reference to an array and want to obtain the references to it's elements from it. What property should I use to accomplish this?
0 Kudos
Message 10 of 20
(3,818 Views)