- Home /
What does the VerticalScrollbar size parameter do?
Hi,
I'm in the process of writing a custom listbox, but I have run into an issue of unpredictable behavior with the vertical scrollbar. Basically, when I click either the up or down arrows, the scroll bar behaves as though I clicked in the PgUp or PgDown areas. If I click in the PgUp/PgDown areas of the scrollbar, then the scroll goes one line up/down at a time. I've noticed the size parameter, but its description ("How much can we see?") is somewhat vague. How should this parameter's value be calculated?
A typical call that I make is
m_iTopIndex = (int)(GUI.VerticalScrollbar(
scrollbarPos,
m_iTopIndex,
2.0F, // have no idea how to calculate properly.
0.0f, // top value
(float)numItems)); // bottom value (numItems == roughly 6800)
Thanks, Brian
Answer by Vitro · May 03, 2013 at 07:22 PM
The size parameter is the size of bar that scroll up and down. You can see a example in this link
http://forum.unity3d.com/threads/177866-GUI-VerticalScrollbar-usage
Thanks. I took a look at post you provided and decided to see how that code behaved. Interestingly, clicking the up/down arrows always scrolls 10 units for each of the scrollbars (the one exception being the middle scrollbar). I would think it would scroll 1 unit. Anyone know if this amount is configurable?