Trapping multiple keystrokes

J. Landman Gay jacque at hyperactivesw.com
Fri Dec 1 16:29:34 EST 2017


On 12/1/17 3:16 PM, Kaveh Bazargan via use-livecode wrote:
> It is the final action I have a problem with, as dozens of arrow key
> actions are held in the buffer. The number keeps increasing or decreasing
> and background actions are triggered.
> 
> Here is a minimal version of the handler I have:
> 
> on arrowKey theKey
>     if theKey is "up" then
>        put current_value + increment into the target
>     end if -- up
>     if theKey is "down" then
>        put current_value - increment into the target
>     end if -- down
>     pass arrowKey
> end arrowKey

Works okay here using only the simplified handler you posted (after I 
added values to the variables increment and current_value.) I'm testing 
in LC 9 dp 10. My test handler, located in a field script:

on arrowKey theKey
   put 1 into increment
   put me into current_value
   if theKey is "up" then
     put current_value + increment into the target
   end if -- up
   if theKey is "down" then
     put current_value - increment into the target
   end if -- down
   pass arrowKey
end arrowKey

Does this simplified handler work for you? If so, then something farther 
along the message path is duplicating the messages. Unless you need it, 
try removing the "pass" statement.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list