Object: KeyboardEvent
The KeyboardEvent object extends the UIEvent object and represents an event generated by the BlackBerry® device keyboard. It provides specific contextual information associated with keyboard devices. Each keyboard event references a key using an identifier. Keyboard events are commonly directed at the element that has the focus.
To create an instance of a KeyboardEvent, you must invoke Document.createEvent() with an input parameter of ”KeyboardEvent”.
Keyboard event types
|
Event type |
Bubbles |
Cancelable |
Description |
|---|---|---|---|
|
keydown |
yes |
yes |
Occurs when a key is pressed while the pointer is over an element. This event type includes the following context information:
|
|
keypress |
yes |
yes |
Occurs immediately after a keydown event. This event does not repeat. This event includes the following context information:
|
|
keyup |
yes |
yes |
Occurs when a key is released while the pointer is over an element. This event type includes the following context information:
|
KeyboardEvent properties
|
Property name |
Type |
Description |
Status |
Support level |
Availability |
|---|---|---|---|---|---|
|
boolean |
Returns true if the ALT key is pressed or if the ALT key is locked. |
read only |
DOM 3 Events |
4.6 or later |
|
|
boolean |
Returns false. BlackBerry® devices have no CTRL key. |
read only |
DOM 3 Events |
4.6 or later |
|
|
keyCode |
int |
Returns the key code associated with the key in this event. |
read only |
Not part of any standard. |
4.6 or later |
|
String |
Returns the identifier of the key. |
read only |
DOM 3 Events |
4.6 or later |
|
|
int |
Returns a value of DOM_KEY_LOCATION_STANDARD. |
read only |
DOM 3 Events |
4.6 or later |
|
|
boolean |
Returns false. BlackBerry devices have no Meta key. |
read only |
DOM 3 Events |
4.6 or later |
|
|
boolean |
Returns true if the SHIFT key is pressed. |
read only |
DOM 3 Events |
4.6 or later |