Scrollbar

Sjoerd Op 't Land sjoerdoptland at mac.com
Mon Feb 18 08:40:01 EST 2002


Ken Ray wrote/ schreef:

> The closest I can come to what you want is:
> 
> set the style of sb 1 to "scale"
> set the startValue of sb 1 to 1
> set the endValue of sb 1 to 3
> set the thumbSize of sb 1 to 1
> set the pageInc of sb 1 to 2
> set the lineInc of sb 1 to 1  -- this is ignored in scales though
> 
> The scrollbar has this script:
> 
> on scrollbarDrag
> set the thumbPos of me to (the thumbpos of me)
> end scrollbarDrag
> 
> This sort of "snaps" to the proper thumbpositions, but it flickers as it's
> doing so. I'll keep hunting for a better solution, but it would be great if
> Rev had a "snapToPage" property (or equivalent) that would take the
> flickering away.
It flickers because you try to execute the handler continuously. A solution
might be using the mouseUp handler:

on scrollbarDrag
  put the thumbPos of me into field 1
end scrollbarDrag

on mouseUp
  set the thumbpos of me to round(the thumbpos of me)
end mouseUp

It then will only snap when released, but it may be acceptable.

> Ken Ray
Regards, / Groeten,
Sjoerd




More information about the Use-livecode mailing list