|
|
|
Scroll Thumb Track
Added on 6/7/1999
|
For use with the Scroll Button Scroll Button, Scroll Thumb, and the Scrollable Sprites behaviors
This behavior allows the author to select direction for the thumb-track (horz or vert). When applied, it allows the user to click anywhere in the track to advance the thumb in large increments toward the mouse click spot.
property pMyDirection -- options are Horizontal and Vertical
property pMyIncrement -- number of pixels that the thumb sprite will advance per click
property pThumbSprite -- the sprite number for the scroll thumb
property pThumbRange -- the range of motion for the Thumb sprite
global gScrollV -- amount scroll has been incremented Vertically from initial value
global gScrollH -- amount scroll has been incremented Horizontally from initial value
on getPropertyDescriptionList
set directionList = [#HORIZONTAL, #VERTICAL]
set p_list = [ ¬
#pMyDirection: [ #comment: "Direction of Slider Track", ¬
#format: #symbol, ¬
#range: directionList,¬
#default: #VERTICAL], ¬
#pMyIncrement: [ #comment: "Incremental change per click (in pixels)", ¬
#format: #integer,¬
#default: 100] ¬
]
return p_list
end
on setThumbV me, range, thumbSprite
set pThumbRange = range
set pThumbSprite = thumbSprite
end
on setThumbH me, range, thumbsprite
set pThumbRange = range
set pThumbSprite = thumbSprite
end
on mouseDown me
if pMyDirection = #VERTICAL then
if the locV of sprite pThumbSprite < the mouseV then
set gScrollV = min (pThumbRange, gScrollV + pMyIncrement)
else
set gScrollV = max (0, gScrollV - pMyIncrement)
end if
sendSprite (pThumbSprite, #scrollThumbV)
sendAllSprites (#scrollV)
else
if the locH of sprite pThumbSprite < the mouseH then
set gScrollH = min (pThumbRange, gScrollH + pMyIncrement)
else
set gScrollH = max (0, gScrollH - pMyIncrement)
end if
sendSprite (pThumbSprite, #scrollThumbH)
sendAllSprites (#scrollH)
end if
end
|
|