It doesn't seem logical to expect a "doScrollUpStuff" handler to also manage all other keystrokes. One would expect the original rawKeyDown handler to manage non-scroll keys by passing them to the engine.

If the intent is to block all keys except those used for scrolling, then Craig's way would work. The method chosen depends on where the handler resides; other keys may not be applicable in a field script where the field is locked. If the handler is in a card or stack script, then passing other keystrokes is usually necessary.


On 12/23/16 3:47 PM, hh wrote:
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.

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode



--
Jacqueline Landman Gay         |     jac...@hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to