04-11-2013 01:58 AM
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
Solved! Go to Solution.
04-11-2013 12:50 PM
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.
04-12-2013 01:05 AM
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.
04-12-2013 01:36 AM
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.
04-12-2013 12:15 PM
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).