Detect scroll activity (when LC is not frontmost)
hh
hh at hyperhh.de
Fri Dec 23 16:47:53 EST 2016
What you say is logically totally wrong.
"DoScrollUpStuff" may of course easily be written such that Craig's
script does the same as your script. And even more, for example
reader's exercises :-))
> Quentin L. wrote:
> sez dunbarx:
> > The "rawkeyDown" message may be trapped as follows:
> >
> > on rawkeydown tkey
> > if tkey = 65308 then doScrollDownStuff
> > else doScrollUpStuff
> > end rawkeydown
> Hold it. That code, as written, will trap *A*L*L* rawKeyDown
> events, and silently kill everything that's *not* a scrollwheel-down
> event. Which, in turn, means that text input is toast, among other
> probably-unwanted side-effects. Try something like this instead:
>
> on rawKeyDown DerKey
> switch DerKey
> case 65308
> DoScrollDownStuff
> break
> case 65309
> DoScrollUpStuff
> break
> default
> pass rawKeyDown
> end switch
> end rawKeyDown
>
> Note that with the switch structure I've used here, there are a
> number of perhaps-useful tricks you can pull… but said tricks are
> strictly outside the scope of the original "how do I detect
> scrollwheel activity?" problem, so I will leave said tricks as
> exercises for the reader.
More information about the use-livecode
mailing list