chasing the thumb in a scrollbar

J. Landman Gay jacque at hyperactivesw.com
Fri Feb 6 01:26:40 EST 2009


Mark Swindell wrote:
> The thumbPosition will give you the position of the thumb relative to 
> the endvalue of the scrollbar itself.  So that if the scrollbar's 
> endvalue is set to 100 (default) and it's halfway along, the thumbpos 
> will be 50.  If the endvalue is set to 200, it will show 100.  But I'm 
> trying to place a graphic based on the actual thumb position relative to 
> the screen, not the scrollbar.

Divide the thumbpos by the endvalue to get a percentage, and use it to 
calculate the number of pixels from the scrollbar left (assuming a 
horizontal scrollbar,) and then add the left of the scrollbar object 
itself to that number to get the x position of the thumb on the card.

put the thumbpos of sb 1 / the endvalue of sb 1 into tPercent
put the width of sb 1 * tPercent into tSBPixels
put the left of sb 1 + tSBPixels into tCdXPos

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list