Trapping multiple keystrokes

J. Landman Gay jacque at hyperactivesw.com
Fri Dec 1 16:18:32 EST 2017


My understanding of the question is that keydown messages are being 
queued and continue to run to exhaustion even after the key is no longer 
pressed. I couldn't duplicate that behavior.

The rawkeydown handler below will manage keypresses but won't solve a 
backed-up message queue. That's why I asked what the handler looked 
like, there may be something there that is causing the behavior.

Or we've all misunderstood the question. :)

On 12/1/17 3:06 PM, Mike Bonner via use-livecode wrote:
> If you're using rawkeydown you can check to see if the key is actually
> still down before doing any processing..
> 
> on rawkeydown  pKey
>      -- since you're checking specifically for arrow keys, you can use pkey
> as the first part of the filter..
> 
> if pkey is among the items of "65361,65362,65363,65364" then
>     -- then determine which arrow key(s) are down and respond accordingly.
>     if 65361 is among the items of the keysdown then -- left arrow key is
> currently down
>                --do stuff for left arrow key here
>     end if
> 
>     if 65362 is among the items of the keysdown then -- up arrow key is
> currently down
>                --do stuff for up arrow key here
>     end if
>     if 65363 is among the items of the keysdown then -- right arrow key is
> currently down
>              --  do stuff for right arrow key here
>     end if
>     if 65364 is among the items of the keysdown then -- downarrow key is
> currently down
>              --  do stuff for down arrow key here
>     end if
> 
> else
>       pass rawkeydown --if a key other than an arrow was pressed, pass it on
> end if
> 
> end rawkeydown
> 
> On Fri, Dec 1, 2017 at 1:27 PM, Richmond Mathewson via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> I may be a bit stupid, but as far as I understand you are trying to do
>> this:
>>
>> 1. You keep an arrow key pressed down,
>>
>> 2. You do other things with other keys while the arrow key is pressed down.
>>
>> I cannot begin to try to answer your question until you either
>> confirm what I have written or say that I am wrong and then
>> explain, clearly, what you want to do.
>>
>> Richmond.
>>
>> On 1/12/17 10:03 pm, J. Landman Gay via use-livecode wrote:
>>
>>> On 12/1/17 11:52 AM, Kaveh Bazargan via use-livecode wrote:
>>>
>>>> I have a field with a number in it. when focused, I want the value to go
>>>> up
>>>> and down with the up/down arrow keys. The trouble is that if I keep the
>>>> key
>>>> down, it traps multiple keydown messages that continue after the key is
>>>> released.
>>>>
>>>> How can I ensure that message are terminated as soon as arrow key is
>>>> released?
>>>>
>>>>
>>> What handler are you using? I just did a test with rawKeyDown and
>>> arrowKey and they all stop when I release the key. (Though arrowkey seems
>>> to be ignoring left and right keys in LC 9 for some reason.)
>>>
>>>
>> _______________________________________________
>> 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
>>
> _______________________________________________
> 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
> 


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




More information about the use-livecode mailing list