keyup not always working

Klaus major-k klaus at major-k.de
Fri Mar 25 04:36:13 EDT 2022


Hi Bob,

> Am 24.03.2022 um 22:26 schrieb Bob Sneidar via use-livecode <use-livecode at lists.runrev.com>:
> 
> I have also run into this. I use rawKeyDown though, that always seems to work. Have you tried rawKeyUp? 

no, since keydown does work, but I will keep this in mind, thank you!

> Bob S
> 
> 
>> On Mar 24, 2022, at 13:58 , Klaus major-k via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> Hi,
>> 
>> I have this in the card script to provide some shortcuts to a player object:
>> ----------------------------------
>> on keyup tKey
>> 
>>  ## Have been bitten by this in the past :-D
>>  if the selectedfield <> EMPTY then
>>     pass keyup
>>  end if
>>  switch tKey
>> 
>>     ## This ALWAYS works:
>>     case SPACE
>>        set the paused of player 1 to NOT (the paused of player 1)
>>        check_time
>>        break
>> 
>>     ## This only works about one out of ten times?
>>     case "r"
>>        set the currenttime of player 1 to 0
>>        check_time
>>        break
>>     default
>>        pass keyup
>>        break
>>  end switch
>> end keyup
>> ---------------------------------------
>> So I added this as a workaround:
>> -------------------------------------
>> on keydown tKey
>>  if the selectedfield <> EMPTY then
>>     pass keydown
>>  end if
>>  switch tKey
>> 
>>     ## This ALWAYS works!
>>     case "r"
>>        set the currenttime of player 1 to 0
>>        check_time
>>        break
>>     default
>>        pass keydown
>>        break
>>  end switch
>> end keydown
>> --------------------------------------
>> Any idea why KEYUP does not work as exspected?

Best

Klaus

--
Klaus Major
https://www.major-k.de
https://www.major-k.de/bass
klaus at major-k.de




More information about the use-livecode mailing list