UIEvolutin Inc.
UJML Language Reference
Key Codes

Key codes are the string values associated with buttons on a device.

Not all devices have the same input capabilities. UJML specifies key codes which you can use as event accelerator key element values in a selection event or which are returned by the _getStringEventData() function. See Handling Events, Selection Events, _getStringEventData() function, key. These key codes are the same on all devices, but may map to the device buttons differently from device to device. To determine which key values are associated with which buttons on a particular device you can experiment using the events.ujml sample

Valid UJML key codes are 0-9, a-z, A-Z, UP, DOWN, LEFT, RIGHT, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, F1, F2, POUND, and STAR. Some devices also support BACKSPACE and CLEAR. These map as follows:

Key Code 
Description 
0-9 
Number keys. 
a-z 
Lower case alphabet keys. 
A-Z 
Upper case alphabet keys. May be accessed using a shift key on some devices. 
UP, DOWN, LEFT, RIGHT 
Arrow keys. 
FIRE 
The key located in the center of the arrow keys on some devices. The 'return' or 'enter' key on other devices. May also be a trigger or select button. 
GAME_A, GAME_B, GAME_C, GAME_D 
Specialized gaming keys. 
F1, F2 
Function 1 and Function 2 keys. UJML does not support higher numbered function keys even if they are available on the device. 
POUND 
The '#' key. 
STAR 
The '*' key. 
BACKSPACE 
Device dependent. Often a marked backspace key. 
CLEAR 
Device dependent. 

The following example shows how to get the key code for the most recent On-Key event. See _getStringEventData() function. It is part of the events.ujml sample.

key = _getStringEventData(&_EVENT_STRING_ONKEY;);

 

The following example shows how to handle the user clicking the 'up' key or using a pointing device to click the on-screen picture of an 'up' button. In either case, it shows a message indicating what happened and flashes the on-screen button. It is part of the events.ujml sample.

<event name="onSelect">
    <accelerators>
        <key>UP</key>
    </accelerators>
    <script>
        showMessage("onSelect: UP");
        flashButton(&BUTTON_UP;);
    </script>
</event>
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
What do you think about this topic? Send feedback!