Type Event Dispatch chain ▸ Runtime Revision Current Public Release (2015.2731) Keywords key
Key events occur when a keyboard key or gamepad/joystick button has been pressed down or released.
In your key event listener, you can return
true to indicate that your app will be handling the received key and overriding the operating system's default behavior. For example, on Android, returning
true for the Back key will prevent the operating system from backing out of your app.
false in the key event listener indicates that your app is not overriding the key and allows the operating system to execute its default behavior.
Android raises key events for all keyboard keys, navigation buttons, volume buttons, and gamepad/joystick buttons. Android does not raise key events for the Home navigation button, Task Manager button, or Power button.
Does not support key events.
The Corona Simulator for OS X and OS X desktop apps support all keyboard keys and gamepad/joystick buttons. Note that the Corona Simulator will provide key events when simulating an iOS device, however iOS itself does not support key events.
The Corona Simulator for Windows and Win32 desktop apps support all keyboard keys, but they do not support gamepad/joystick buttons. The Corona Simulator for Windows only provides key events when simulating an Android or Windows Phone device, as iOS does not support key events.
Only the Back key is supported on Windows Phone.
Key events will not be received if a native object such as a TextField, TextBox, or WebView handles them. This can only happen if these native objects have the focus and if they choose to override that key. For example, a TextField and TextBox typically handles all keyboard keys, preventing the application from receiving those key events, but will not handle a Back key event.