doing simple 2D scrollbar

Blitz3D Forums/Blitz3D Programming/doing simple 2D scrollbar

Rob(Posted 2004) [#1]
...in Blitz3d. I don't want to use a gui and have gotten confused.

A friend suggested I divide the scrollbar size by the number of elements but thats not working out either. I just want to know the basic formula to make a simple vertical scrollbar.

I have the following data: the height of the scrollbar area, the scrollbar position, and the height of the area to scroll in pixels (it's a long picture of some kind)...

Thanks lads!


semar(Posted 2004) [#2]
I assume you want a 2D scrollbar, using 2D commands like DrawImage and the like..

If so, I would play a bit with Viewport related commands (2D and 3D). The key here is to draw part of the big image, depending on the value of the bar.

The bar image should be also partially displayed, accordingly with its value.

Hope this helps,
Sergio.


aCiD2(Posted 2004) [#3]
Basically, you need to divide the total height of the item (think of a textbox that keeps going so all the writing fits in, and divide it by the height of the gadget (- the arrow heights), eg image box. That's basically what i do. Also, ya, play with viewport and origin so that you can draw the image, and it stays only in the gadget.

Hope that makes sense :\