06-10-2014 06:43 AM
Hi,
Is anyone aware of an object in existance that I can wire a control in one end (or the local variable of a control) and get the control reference out? If not I could consider building one..?
Many thanks, Alec
06-10-2014 07:11 AM
Right-click on your control. Choose Create->Reference.
06-10-2014 07:15 AM
Hi Crossrulz,
Sorry you misunderstand, I would like an OBJECT that will perform this operation, I need to programatically aquire the reference of a control. IE a sub vi who's input is a control (any, will probably be a polymorphic suite) and who's output is a reference to that control.
06-10-2014 07:32 AM
Hey,
(I guess) it could be done with VI scripting.. but this solution is limited ... VI scripting is not available in the Runtime Engine.
Regards,
CMW
06-10-2014 07:43 AM - edited 06-10-2014 07:44 AM
There is no direct method to achieve this (as far I know), but I can suggest another way around. Instead of wiring the control to the sub vi you can wire the label of that control to that sub vi along with the main vi reference, inside you can gather the reference of all the controls of the main vi and take the reference according to the label. Will that suffice?
06-10-2014 07:50 AM
I was also going to suggest searching by the label. You will need to use the VI reference to get the Front Panel reference to get a reference to all of the controls and indicators on the front panel. You can then do a search in a FOR loop for the control you want.
06-10-2014 08:07 AM
OK What I really want is to be able to wire a control or local variable up to a VI and have that VI return the control's label. I assumed the best way to acheive this was using the reference.
06-10-2014 08:08 AM
Hi, I had thought that maybe there would be a way of using scripting to find out which control is wiring to the VI's specific clone and use that information to seach through the 'Controls[]' off the calling VI to decide which was the correct reference, would I HAVE to use scripting for this?
06-10-2014 08:58 AM
You may be able to do this, but it is very indirect, will require some experimentation, and will probably never work reliably. Before starting, it is important to understand that, to scripting, a subVI and a VI are very different. A VI is the code. A subVI is the calling mechanism between a VI and its called code (also, unfortunately, called a subVI). Try the following:
I believe all of this will work in the run-time engine, since you are not changing anything, but check each property and method you use in the LabVIEW help to confirm.
Good luck!
06-10-2014 09:33 AM
Hi,
I have got a bit of the way through writing this code, I think, but at the moment when I try and cast down the reference to the subVI i get rejected, can anyone spot what im doing wrong here (I apologise for the scruffy code, this is a bit of a work in progress)
Many thanks, A;ec