LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array scroll bar event

Is there any way that I could get the event from array scroll bar in LabVIEW 8.5? I have an one-dimensional array and I made the vertical scroll bar visible. What I want to do is that when I drag the scroll bar to change array index value, I need to change the content of another array that will display the visible line number of the first array. Array index display only is not suitable for my application.
0 Kudos
Message 1 of 12
(6,382 Views)


Jason2006 wrote:
I need to change the content of another array that will display the visible line number of the first array.
I don't quite understand what you mean by "visible line number of the first array". Arrays don't have line numbers. Do you just want to scroll it to the same element as the first array?
 
In this case you could do something like the following (hey, it even works for multidimensional arrays! :)):
 

 
Message 2 of 12
(6,379 Views)
I would just use the mouse up event to change the index of the second array. Mouse up is needed if users use the scroll bar arrow buttons instead of dragging the slider.
_______________________________________
Systems Test Engineer
Certified LabVIEW Architect (CLA)
0 Kudos
Message 3 of 12
(6,371 Views)

Basically what I'd like to do is part of my GUI. Like in the example, there are 2 arrays. One array called Array is with scroll bar. Another array called Array2 is without scroll bar. What I called "visible line number" in this example is 4 lines that we can see. What I expected is that Array2 will display the so-called line number of Array. At the beginning, I expected Array2 will display 1,2,3,4. After scrolling Array, let's say, the top element of Array index is 3, then I expect Array2 will display 3,4,5,6. etc. In this example, both Array and Array2 has 9 elements. If I scroll Array so that the top element of Array index is 7, then I expect Array2 will display 7,8,9 and last element will grey out. I just want use Array2 to display so-called line number of Array so that customer could track where the Array is. Once again, Array index may not appropriate and understandable for the customer.

In this example, if I press so-called up and down arrow at the scroll bar side, Array2 does not follow. If I add and delete one element in the Array, Array2 does not follow either. I just wonder whether I could get the event from Array scroll bar, that will be easy. But I could not find such event for an array.

0 Kudos
Message 4 of 12
(6,367 Views)
Just use the mouse up event, when user drags the slider, Array2 may not response "real time".
0 Kudos
Message 5 of 12
(6,365 Views)


Jason2006 wrote:

If I add and delete one element in the Array, Array2 does not follow either.


If you delete an element, it should work. How are you deleting the element?
 
Here's a quick modification that might bring you a little bit closer. Modify as needed.
 
Of course with some effort, you could wrap all this into a single xcontrol for full flexibility and code simplicity. 🙂
Message 6 of 12
(6,354 Views)
Hi  altenbach,
 
It works. Thank you. I also write a similiar example as attached. It is a good idea to make it a XControl. At beginning, I just wonder if we can get an array index value change event from scroll bar, it may be much easier.
0 Kudos
Message 7 of 12
(6,346 Views)


Jason2006 wrote:
I also write a similiar example as attached. It is a good idea to make it a XControl.
I don't think there is an event for the array scrollbar changed or index changed.
 
The reason I placed the code inside a case structure is the fact that property nodes are quite expensive and you are constantly executing all that code even if the mouse just travels over the array control without clicking. My version only executes if the mouse is actually down, making it less demanding on the system.
 
An Xcontrol requires quite a bit of work and is probably only useful if you want to re-use that gadget everywhere.
0 Kudos
Message 8 of 12
(6,342 Views)

..i have the same problem, but the solution doesn't seem to work properly in a particular case.

If I start scrolling the scrollbar and then I move the mouse off the control, the mouse move event stop but the scrolling of the control continue leaving the "master" array with an inedx value different from the "slave" array.

Any other solution to solve this issue?

0 Kudos
Message 9 of 12
(4,853 Views)

gepponline wrote:

If I start scrolling the scrollbar and then I move the mouse off the control, the mouse move event stop but the scrolling of the control continue leaving the "master" array with an inedx value different from the "slave" array.


Are you seeing this behavior when using the mouse wheel? If so, you could modify the example posted earlier to include a mouse wheel event to get similar functionality. 

0 Kudos
Message 10 of 12
(4,814 Views)