views:

21

answers:

2

I'm making an application that has many lines of data coming back from a Database stub(which will become an Oracl database), and for some reason the srcoll bar stops at about the 500th element. I'm wondering if there's anyway to have all the elements show within the scroll bar.

A: 

You might need to set the minimum and maximum values of the ScrollBar. You would use the setMinimum() and setMaximum() methods, respectively.

It's also a good idea to set the page increment. This is the number of scroll lines that the selected value changes by when the user clicks the area between the thumb and the arrow buttons, or presses the Page Up or Page Down buttons. You would use the setPageIncrement() method.

Finally, Oracle may impose a maximum number of rows you can retrieve from a table. I believe the default is 500 rows.

Gilbert Le Blanc
+1  A: 

I'm assuming here that you're using Windows, because there is a fairly general problem with scrollbars on Windows: the maximum value is a short int, 32,768. Therefore, if the height of the inner composite of a ScrolledComposite is greater than 32,768 pixels, the composite will be clipped.

I haven't found a robust way of fixing this, but there is a workaround: separate the scrollbar from the composite that you wish to scroll. You can't create a ScrollBar, but you can make a ScrolledComposite that is precisely as wide as a ScrollBar, then attach a ScrollListener to it and have it adjust the layout position of the scrolling composite.

Somewhere I have a snippet, but I'm not even exactly sure if this diagnosis applies to your scenario.

Paul Lammertsma
After playing with it a little, I've found that the problem is a bit more generic: the maximum height of a composite is 32,768.I resolved my own issue using buffering: at any given moment, only a small composite is displayed containing a subsection of the information. When scrolling, the buffer is updated and displayed accordingly. (It was a massive task and very specific to my data.)
Paul Lammertsma