User Guide
270 APPENDIX E
myEventHandler = KeyEventHandler();
myEventHandler.setFilterOnKeyUp();
myEventHandler.onEvent = function(keyEvent)
{
chat.print(“Key up key code = “ + keyEvent.keyCode);
}
KeyEvent
A KeyEvent is not an object that you can modify. Rather, it is an object that is returned in the “KeyEventHandler.
onEvent(KeyEvent, what)” callback.
When you create a new KeyEventHandler(), you assign a fi ltering method to specify the events to which the handler
should respond. For example, “MyKeyEventHandler.setFilterOnKeyDown()” instructs this handler to respond only
when the user presses a key while the focus is on the rendered window. Following the click, the handler responds by
triggering the “MyKeyEventHandler.onEvent(KeyEvent)” callback function, and processes the code you have written
for this function. The “KeyEvent” described below is returned as an object, and possesses possesses the key code for
the key pressed, as well as several other properties.
Properties
keycode
the numeric value of the key pressed (see table below)
keydown
true for key down event, and false for key up
metaKey1Down
true if ‘SHIFT’ key was also held down during key event
metaKey2Down
true if ‘CTRL’ key was also held down during key event
metaKey3Down
(currently not used)
metaKey4Down
(currently not used)










