chasing the thumb in a scrollbar

Phil Davis revdev at pdslabs.net
Fri Feb 6 01:27:18 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.
>
> Mark


Hi Mark,

This isn't perfect but it's a starting point if you want to do it this 
way. I broke the formula down to its parts instead of doing a one-liner:

on scrollbarDrag pNewPosition
   put the left of me into tWindowOffset
   put the thumbSize of me div 2 into tThumbOffset
   put (the endValue of me - the startValue of me) into tMyUnits
   put the width of me / tMyUnits into tPixelsPerUnit
   put round(tPixelsPerUnit * (pNewPosition - tThumbOffset)) into tThumbH
   set the right of btn 1 to (tThumbH) + tWindowOffset
end scrollbarDrag


I created a button that follows the thumb around - not perfectly, but 
you want to tweak it anyway, right?  ;o)

Hope this helps -
Phil Davis


> On Feb 5, 2009, at 9:44 PM, dunbarx wrote:
>
>> mark.
>>
>> So this is a scrollbar control, not a field. Right. I have not played 
>> with these yet, but don't I remember that there is a property that 
>> indicates the relative position of the thumb with respect to the 
>> amount of "progress" in the control, and isn't this even closer to 
>> what is needed without all that stuff I mentioned?
>>
>> Craig Newman
>>
>>
>> On Feb 6, 2009, at 12:38:06 AM, "Mark Swindell" 
>> <mdswindell at cruzio.com> wrote:
>> That won't work in this case as it's just a horizontal scrollbar not
>> attached to a field or group.
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your 
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the Use-livecode mailing list