Trapping multiple keystrokes

Kaveh Bazargan kaveh at rivervalleytechnologies.com
Fri Dec 1 16:41:09 EST 2017


On 1 December 2017 at 21:29, J. Landman Gay via use-livecode <
use-livecode at lists.runrev.com> wrote:

> 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.


Thank you so much Jacqueline

This indeed works. But if something is done in the background then the
problem starts. (I am using the same version of LiveCode.)

I tried this:


on arrowKey theKey
   put 1 into increment
   put me into current_value
   if theKey is "up" then
      put current_value + increment into the target
      repeat with i = 1 to 1000000
         put 1+i into temp
      end repeat
   end if -- up
   if theKey is "down" then
      put current_value - increment into the target
   end if -- down
   pass arrowKey
end arrowKey

The down arrow works but up arrow has the problem I have mentioned.


>
>
> --
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
Kaveh Bazargan
Director
River Valley Technologies <http://rivervalleytechnologies.com/> • Twitter
<https://twitter.com/kaveh1000> • LinkedIn
<https://www.linkedin.com/in/bazargankaveh/>
Phone +44 7771 824 111



More information about the use-livecode mailing list