LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to get a control's refnum from a local variable or wire?

Solved!
Go to solution

I'm looking for a way to get a front panel item's refnum from a local variable or wire. Is this possible?

 

Is there a way to accomplish the following?  (These are edited images, you cannot currently do this in LV)

17795i6638C0BB81D638E0

or perhaps

17797i409A89A31AE35699

 

If this kind of thing is not possible, is there a reason for it? If there's no reason why this can't be done, I'll go put this on the suggestion boards.

0 Kudos
Message 1 of 4
(2,665 Views)
Solution
Accepted by topic author dthor

Why do you need this?

 

A wire is simply data. It is not associated with a control.

Similarly, a local variable is a way to access a control's data, not to interact with the control itself.

 

Is right clicking the control and selecting Create>>Reference not good enough for you?

 

You can write code to get the reference of controls connected to the wire and of the the control whose local variable you want, but I get the feeling this isn't actually what you want.


___________________
Try to take over the world!
Message 2 of 4
(2,652 Views)

The wire contains a value, ie. just a number.  So you can't really get a reference from the value.  The reverse is possible, you can easily get the value given the reference.

 

I am not sure what you are trying to do, but you should probably be thinking in terms of passing references around and occasionally getting the value instead of passing values around and trying to get the reference.

 

Numerous caveats follow, overuse of property nodes can slow things down and make your BD grow quite large.  Same for locals.

 

It is a matter of personal opinion as to when the complexity is worth it.  My sense is that if we knew what you were trying to do, we could suggest alternate ways of getting it done.

Message 3 of 4
(2,651 Views)

I'm taking someone else's code and updating it, merging it with code I've written. I use references, he didn't. Having the option of wiring anything into a property node would greatly reduce the time required to rewrite his code. That's really all I was looking for.

 

And yes, Right Click -> Create Reference (or linking property nodes) is what I've been using.

 

Thanks guys

0 Kudos
Message 4 of 4
(2,643 Views)