keyup not always working

Klaus major-k klaus at major-k.de
Thu Mar 24 16:58:23 EDT 2022


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