LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

scroll two array indicators simultaneously

Solved!
Go to solution

How to scroll two array indicator's scrollbar simultaneously?

Thanks in advance

0 Kudos
Message 1 of 11
(4,851 Views)

thusly

Login.PNG


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 11
(4,845 Views)

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?

 

0 Kudos
Message 3 of 11
(4,834 Views)

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 Smiley Wink  (anything between 10 - 200 mSec is usually fast enough for a UI.)

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 4 of 11
(4,830 Views)
Solution
Accepted by topic author lxkarthi

Try this minor mod-  to allow either scroll to be active-  and as NIquist said- throttle down the loop


"Should be" isn't "Is" -Jay
Message 5 of 11
(4,825 Views)

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.

Tim
GHSP
0 Kudos
Message 6 of 11
(4,822 Views)

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:

 

 


"Should be" isn't "Is" -Jay
Message 7 of 11
(4,809 Views)

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.

Tim
GHSP
Message 8 of 11
(4,797 Views)

@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:

 

  1. Read A  Read B Write B Write A -- or its converse simply swaps the index values and will never work right.
  2. Read A Write B Read B Write A-- A is the master- changes to B are overwritten before the can be applied and you get a "Locked" feel to B - probably what the OP observed
  3. Read B Write A Read A Write B  B is the master- changes to A are overwritten before the can be applied and you get a "Locked" feel to A

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) 


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 11
(4,760 Views)

Hide both Index values and use a seperate slider to move both indexes.

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 10 of 11
(4,749 Views)