I'm making a simple custom scrollbar and I'm trying to calculate the scroll value so it relates to the groupscoll value of the target.
Does anybody know the formulae for this?
The scollbar consist only of two graphics - the border of the scrollbar and the thumb.
Sjat
calculating the hscroll value in a custom scrollbar
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
calculating the hscroll value in a custom scrollbar
Last edited by Sjatplat on Tue Mar 25, 2014 9:10 pm, edited 1 time in total.
Re: calculating the scroll value in a custom scrollbar
Hi.
Is the "thumbPosition" property what you are looking for? I am not sure what you intend to relate this value to. Is there a correspondence to the scroll property of a group? If so, you can scale the thumbPosition and the scroll of the group together.
Craig Newman
Is the "thumbPosition" property what you are looking for? I am not sure what you intend to relate this value to. Is there a correspondence to the scroll property of a group? If so, you can scale the thumbPosition and the scroll of the group together.
Craig Newman
Re: calculating the scroll value in a custom scrollbar
Thank you for answering.
I think i got the formulae of resizing my custom thumb according to the group: formattedwidth-width of the target group and then calculate the percentage of this relation to get my custom thumb the right size.
let's say I then put my custom thumb at the very end (in the right end of my scrollbargroup) and want to calculate the hscroll value of this position (so its the same as the hscroll end of the target).
Is it the endposition(the right of the thumb)- the width of the thumb/2???
As you see - i have a hard time even explaining...
I think i got the formulae of resizing my custom thumb according to the group: formattedwidth-width of the target group and then calculate the percentage of this relation to get my custom thumb the right size.
let's say I then put my custom thumb at the very end (in the right end of my scrollbargroup) and want to calculate the hscroll value of this position (so its the same as the hscroll end of the target).
Is it the endposition(the right of the thumb)- the width of the thumb/2???
As you see - i have a hard time even explaining...

Re: calculating the hscroll value in a custom scrollbar
Hi.
It is not the width of the thumb (which has its own property, the "thumbSize") but rather the start and end value of the scrollbar itself. Make a new scrollbar. In the inspector you will see properties that are settable, especially the start and end values. These can be scaled in many ways. So if you had a total spread of 100, say, then when that thumb was halfway along, you could then set another scrolling object, like your group, similarly.
Or anything else. Maybe the other scroll percentage could be different, so that when the scrollbar was 50%, the group scroll was only 25%. Do experiment with various different scrolling objects, and set their start and end values in playful ways.
Is this what you needed?
Craig
It is not the width of the thumb (which has its own property, the "thumbSize") but rather the start and end value of the scrollbar itself. Make a new scrollbar. In the inspector you will see properties that are settable, especially the start and end values. These can be scaled in many ways. So if you had a total spread of 100, say, then when that thumb was halfway along, you could then set another scrolling object, like your group, similarly.
Or anything else. Maybe the other scroll percentage could be different, so that when the scrollbar was 50%, the group scroll was only 25%. Do experiment with various different scrolling objects, and set their start and end values in playful ways.
Is this what you needed?
Craig