

Determine if a key has been pressed and store this in a variable.

If no key has been pressed, the program should continue without waiting.




i = {};
EventHandler[Panel[Dynamic[i], 
  ImageSize -> {300, 300}], {"KeyDown" :> 
   AppendTo[i, CurrentValue["EventKey"]]}]