LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Control (2d) and Scrolling

(LabVIEW 2017)

 

Here's what I have working: a 2d array control that programmatically resizes with respect to the dimensions of the control's value and the size of the window. As a different instrument is selected the array might vary from something as small as 1x1 (rare) to even greater than 256x256. As the window is resized (or a different instrument selected), the control is programmatically resized so it's never larger than the current dimensions of the array but, for larger arrays, fills up as much of the window as possible. I'll also mention that there are horizontal and vertical legends in the form of 1d arrays and as the IndexVals property of the 2d array changes (it's monitored in a Timeout event), the legends' IndexVals are set so they smoothly scroll in sync with the 2d array. This is all working.

 

The problem begins with scrolling to the end and, alas, past it.

 

Using the scrollbars I can get to the column or row past the end which now appears in grey. Even worse, the end user could "add" meaningless columns or rows to the array. And, if that's not bad enough, using the two-finger scroll gesture (or a mouse-wheel, but I forgot what that is :)) I can keep scrolling so that the control is completely grey.

 

I'd have absolutely no problem switching to an indicator (and "manually" use Mouse Down events to set the Val(Sgnl) property) which solves scrolling past the end but the scroll gesture/wheel doesn't work on the indicator, only the scroll bars. (Why is that? Is there some way to make them work? Am I missing something?)

 

Currently, I'm using the above mentioned Timeout event that scrolls the legends to also coerce the 2d array back to the "valid" area. This works but there are big problems:

  • It flickers and doesn't look nice
  • The scroll bars indicate that it's not at the bottom/right which also doesn't look nice

At this point, it seems like my least worst option is to change it to an indicator and use the Mouse Wheel event to update the IndexVals properties. (In addition to a Mouse Down event to update Val(Sgnl).)

 

Please tell me there's finally some intrinsic way to limit scrolling in an array control or, absent that, some intrinsic way to make the scroll gesture/wheel work on indicators.

 

Or is there an altogether better way?

 

Thanx.

 

 

 

 

 

0 Kudos
Message 1 of 3
(2,738 Views)

Only one idea comes to mind.

 

Hide the built-in scroll bars and use discrete scroll bars instead. Yes you will have to resize them and position them yourself.

 

There is a "doc max" property for a scroll bar that may help.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 3
(2,734 Views)

I saw that idea in my travels through Google. But if the array doesn't have scrollbars, the gesture/wheel doesn't work (intrinsically) on the control too.

 

It's not an idea that I would reject outright since they generate a Value Changed event vs having to poll the IndexVals property. But the trade-off to eliminating the polling (which isn't as cool as an event) is the additional work to resize and reposition the scroll bars. It's a very close call.

 

Thanx.

 

0 Kudos
Message 3 of 3
(2,711 Views)