LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Vi that returns the reference of a specific control

Hi there,

I wonder if there exists a vi that receives a control and throws out the
controls reference?
Thank you for your help!
0 Kudos
Message 1 of 3
(2,593 Views)
What does a VI do when it "receives a control"? If you mean receives data from a control then that control must be wired into the VI...and if you have wired the control then you migh as well have wired it's reference to it (right-click on the control and select create reference), but then you already have the refrence. If you mean identify the reference to the origin (control) of the data coming via e.g. a global then no, the data does not contain a reference.

You can however generate references to control without creating a reference...any VI can find the reference to any control using VI server functionality. Open a reference to the VI of which you need a control reference from, use a property node to read the front panel refrence of that VI, then wire that re
ference to another property node and select the controls property. Now you have an array containing the reference to all the controls in that VI...if the index of the reference you are looking for is fixed then just read that index of the array...however if you want to dynamically find the reference, wire the name of the control into the VI that is to find the refrence, then use the control reference array to read out the names of the controls (wire the references one by one to a name property)...searching through it until you find the reference for the control with the given name...

Is that what you are looking for?

See attached example.
0 Kudos
Message 2 of 3
(2,593 Views)
The only way of programatically creating a reference to a control is to use property nodes. If you open a reference to a VI, there is a "Panel" property that outputs a reference to that VI's front panel, that reference in turn has a property called "Controls[]" that is an array of all the controls and indicators in the VI's front panel. Each of those control references in turn has a property called "Label.Text", which is the label of the control.

Describing this in words is rather painful and obtuse so I have attached a VI (someone else wrote for another discussion) that allows you to programatically move all the controls on the front panel at the same time--in essence scroll the screen. It shows how this all fits together.

Mike..

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 3
(2,593 Views)