12-28-2011 05:37 PM
Hi,
Beginner's question.
Suppose I have a dial controller and a list controller (a list of numbers). I would like to do the following
Set the dial control to whatever the list controller is currently showing and update the selected item on the list whenever the dial controler changes.
How can one change the content of the list box on the run? If this is not possible, what type of controller should I use ? (table?)
What is the easiest way to hook up a graphical controller to multiple values selected from a list?
Thanks!
-- Shay
01-13-2012 04:12 PM
Hi shayn,
If you just want to update the values of a list of number to a dial indicator, you could just create a numeric array with the number you want and use the Index Array function to wire each element of the array out.
01-13-2012 04:51 PM
Red's solution works with a dial indicator, so it only works in one direction. The dial will update when the list is changed, but the list will not update when the dial is changed.
Here are two solutions that do what you asked.
The first one, you will notice is jumpy and unreliable. This is because it has an uncontrolled race condition. The program tries to update the values at the same time the user is changing them.... sometimes the program wins, sometimes the user wins. (You'll notice it works about 50% of the time). If you remove the sequence structure, it pretty much never works because the values are always colliding.
The second example uses a controlled condition to decide when to update the values. It uses a shift register to hold the previous value from the control and then checks the current value against the previous value. If the two values are the same, no change needs to be made. If the current value is different than the previous value, it updates the other control.
01-13-2012 10:19 PM
The proper way to this where you have 2 controls, and you want one to update when the other changes, is to use an event structure.
Have and event case for each control set for Value Changed. When one control is changed, it will update the other via a local variable or Value property node. Likewise in the Value changed event for the other control.