View Full Version : setting scrollbar limits

6th September 2012, 13:56

i have a custom drawn widget, that has a horizontal scrollbar. Here
is a very nice description how to choose min/max values, but because i am incompetent, i can get it to work.

I have these values:

x = total number of rows
y = exposed number of rows

and need these:

min, max, singelstep, pagestep

I would say three of them are clear:

min = 0
singlestep = 1
pagestep = y

choosing a max value is the challenge here.

if we just do

max = x

then that works OK, but if we scroll down all the way, the screen will be "empty", because the last line to display is above the visible area.
First thing that comes to mind is doing max = x-y. Then only half the screen is empty when we scroll full down. Not sure why, though.

This shouldnt be too hard, but my brain got stuck somewhere. :(
any help i appreciated.

8th September 2012, 08:03
One option is:

min = 0
singlestep = height of row
pagestep = number of visible rows * height of row
max = number of rows * height of row - pagestep