06-08-2011 08:07 AM
How to scroll two array indicator's scrollbar simultaneously?
Thanks in advance
Solved! Go to Solution.
06-08-2011 08:43 AM - edited 06-08-2011 08:44 AM
thusly
06-08-2011 11:05 AM
I used this method for both scrollbars. I connected Index Values property nodes from scrollbar1 to scrollbar2 and from scrollbar2 to scrollbar1 so that i can move any one of the scrollbars to scroll both. But when i move scrolbar 1, it moves finely. when i move scrolbar2, it shakes and moves.
is there any other way to do this?
06-08-2011 11:13 AM - edited 06-08-2011 11:16 AM
Your VI works fine on my dual core but it's maxing one core. If you have a single core you're going to bog down because you neglected to put a throttle in your while loop. Add a Wait.vi with a 10 mSec delay and see if that helps.
EDIT: As Jeff's example shows (anything between 10 - 200 mSec is usually fast enough for a UI.)
06-08-2011 11:20 AM - edited 06-08-2011 11:21 AM
Try this minor mod- to allow either scroll to be active- and as NIquist said- throttle down the loop
06-08-2011 11:23 AM
The problem that you have is that you are writing to both indexes at the same time. You need to react to which ever control that you are using. I added event structure and it seems to work better.
06-08-2011 12:02 PM
Tim,
Yes, that will work it has a drawback. Those silly mouse move events seem to really pile up especially when the user plays around with the FP so I tend to avoid them since they either A) run full throttle and consume the core or, if a wait is added to avoid this B)lock up the front panel because of the defer panel updates being set while the many mouse move events are executed, OR if FP updates are not defered, C) cause the FP to do crazy stuff lagging behind the user's activity especially when there are other events the structure is handleing. (Guess why I use a seperate loop for stuff like this):smileywink:
06-08-2011 12:16 PM
Yes I agree I just wanted to show an alternate method. The real problem is trying to talk to both index values at the same time.
06-08-2011 12:30 PM
@aeastet wrote:
Yes I agree I just wanted to show an alternate method. The real problem is trying to talk to both index values at the same time.
True- we can't determine the order of operation between the writes and reads in the implementation the OP presented a Classic race condition and no good way to enforce data dependancy without creating a single master scrollbar. consider the following cases:
the mod I presented compares A and B if different, the value that was changed is applied to both (compare A to Last Val on SR if not = then A changed if = B must have changed)
06-08-2011 01:32 PM
Hide both Index values and use a seperate slider to move both indexes.