scrollbar "detentes"

Josh Mellicker josh at dvcreators.net
Thu Sep 6 02:27:14 EDT 2007


Just thought I'd share this script that gives a scale scrollbar  
"detentes" in case it might come in handy to someone.

When the user lets go of the mouse within tSnap increments of  
tSnapVal, the scrollbar snaps to the tSnapVal value.


ON mouseUp
     put the thumbposition of me into pScrollValue
     snapIt pScrollValue, 768, 100
     snapIt pScrollValue, 1500, 200
     snapIt pScrollValue, 2500, 200
END mouseUp

ON snapIt pScrollValue, tSnapVal, tSnap
     IF abs(pScrollValue - tSnapVal) < tSnap THEN
     set the thumbposition of me to tSnapVal
     END if
END snapIt


I used mouseUp instead of scrollBarDrag because the snapping only  
happens afterwards and not during the drag, which causes flickering...



More information about the use-livecode mailing list