LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linking controls by reference

Solved!
Go to solution

Hi there, 

 

I would like to know whether there is a possibility to link controls of the same datatype by reference, so they contain the same data.

 

This would mean that when writing to a "Value" property of the reference it automatically updates the linked control without having to update it 'manually' from within a loop or using a "Value (Signaling)" / event combination.

 

I would like to use it for a central display (single formatted control) which can be switched to display one of multiple contiuously updated values (currently by value property). For example allow a user to select between analog inputs 0..7 then display the appropriate value accordingly (and keep updating automatically).

 

Kind regards, W@Work

 

 

0 Kudos
Message 1 of 5
(2,483 Views)

Can you share any code that demonstrates what you hope to do? Are you asking if there's some way to have a value on the screen update automatically without wiring to the indicator's terminal (or a local variable or property node)? No, there is not. Values only exist on wires and the way you link a wire to a front-panel item is, logically enough, by connecting the wire to the front-panel item.

 

One approach is a separate loop that handles all updates of front-panel items. Put the data into a queue, and dequeue it in the front-panel-update loop, then make the necessary updates.

0 Kudos
Message 2 of 5
(2,446 Views)

Thanks for your reply,

 

I've attached a simple vi which I hope explains what I would like to do.

 

Instead of wiring the actual value (through either property node or terminal) as you would normally do, I would like to wire a reference to a control so it becomes somewhat of a clone and copies any data written to the original control. I suspected this won't be possible, but thought it was worth asking. 

0 Kudos
Message 3 of 5
(2,432 Views)

There is one way to update many controls by a single update, by using a shared variable and binding the controls that you want to the shared variable. So when you write values to the shared variable all the controls/indicators will get updated automatically. I am not sure whether this is the solution you are looking for.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 5
(2,424 Views)
Solution
Accepted by topic author WatWork

Nope, no such construct. A better solution would be to pass data around, rather than control references. In the data-generating loop, instead of writing to the control references, bundle the values and put the cluster into a notifier. Then, in the other loop, pull the latest notification, select the appropriate value and connect it directly to the indicator. Control references are inefficent (they require a switch to the user interface thread).

0 Kudos
Message 5 of 5
(2,410 Views)