More send in time
Cubist at aol.com
Cubist at aol.com
Thu Jul 3 09:00:01 EDT 2003
sez pixelbird at interisland.net
> sez cubist at aol.com:
>> if within(graphic "upScrollArea", mouseLoc()) then
>> set the vScroll of fld 1 to (1 + ((the vScroll of fld 1) + 1343) mod 1345)
>> else if within(graphic "downScrollArea", mouseLoc()) then
>> set the vScroll of fld 1 to (1 + ((the vScroll of fld 1) + 1345) mod 1345)
>> end if
>-----------
>So what's wrong with this?:
>on endlessScroller
> constant scrollSpeedInterval = 10
> if not the uAllowScroll of me then exit endlessScroller
> if within(graphic "upScrollArea", mouseLoc()) then
> set the vScroll of fld 1 to ((the vScroll of fld 1) + 1344) mod 1345
>## Causes a negative 1, so it starts immediately and
>## continues in that direction.
> else if within(graphic "downScrollArea", mouseLoc()) then
> set the vScroll of fld 1 to ((the vScroll of fld 1) + 1345) mod 1344
>## Causes a positive 1 and continues in that direction
> end if
> send "endlessScroller" to me in scrollSpeedInterval milliseconds
>end endlessScroller
>...That thing works flawlessly in my setting.
I don't see anything wrong with it, issues of style or personal preference
aside.
>-----------
>
>> As long as this bit of code is *only* activated when the mouse is within
>
>> one of your two "xxxScrollArea"s, it should work fine. Hmmm... try this on
for
>> size:
>> # in card script
>> on ScrollControl
>> if within(graphic "upScrollArea", mouseLoc()) then
>> ScrollDatPuppy (-2)
>> else if within(graphic "downScrollArea", mouseLoc()) then
>> ScrollDatPuppy (0)
>> send "ScrollControl" to me in 10 milliseconds -- adjust to taste
>> end ScrollControl
>>
>> on ScrollDatPuppy Direx
>> set the vScroll of fld 1 to (1 + ((the vScroll of fld 1) + 1345 + Direx
mod 1345)
>> end ScrollDatPuppy
>-----------
>I tried this, but it scrolls just one pixel, then quits. I haven't figured
>out why yet.
Hm. This is odd. Once you've triggered ScrollControl *at all*, the "send
in 10 ms" line *should re-trigger itself forever and ever, Amen... Perhaps add
another set of parentheses to ScrollDatPuppy? I.e.,
set the vScroll of fld 1 to (1 + (((the vScroll of fld 1) + 1345 + Direx)
mod 1345)
More information about the use-livecode
mailing list