< Index | Device Keys and Kuix

Device Keys and Kuix

Kuix simplify the overall use of keys. You will start in this guide with a list of all available keys support by Kuix and then you will discover how use them in many examples.

Keys list

Key Syntax KeyDescription
0 Numeric 0
1 Numeric 1
2 Numeric 2
3 Numeric 3
4 Numeric 4
0 Numeric 5
5 Numeric 5
6 Numeric 6
7 Numeric 7
8 Numeric 8
9 Numeric 9
* * key
# # key
softleft The menu key located on the left just under the bottom left of the screen.
softright The menu key located on the right just under the bottom right of the screen.
up direction up key (stickpad)
left direction left key (stickpad)
right direction right key (stickpad)
down direction down key (stickpad)
fire OK button (on almost models it is located in the middle of the stickpad)
back the back button (mainly Sony Ericsson have it and is it commonly situated just under the softleft button)
delete the delete button (commonly symbolized by a "C")
pencil the pencil button (wich is available on some Nokia device such as 66xx series)

 

Keys usage

The main use of keys are in shortcuts. Theses shorcuts allow you to handle an action even if the associated widget is not focused.

ActionWidget shortcut

Keys are part of User Interface. So they are defined in screens. And due to screens could be created in XML, key shortcuts could be implemented in XML too.

The easiest use is:

<screen title="Kuix Key example">
    <button onAction="myButtonAction" shortcuts="softright">myButton</button>
</screen>

 

If you press softright key, then the action myButtonAction will be called. If the widget resgistering the shortcut doesn't extends ActionWidget, by default, nothing is done. (for example: button, checkbox, listitem etc... are ActionWidget child)

ActionWidget multiple shortcuts

You can specify multiple shortcuts for 1 widget sperated with '|' character:

<screen title="Kuix Key example">
    <button onAction="myButtonAction" shortcuts="softright|softleft">myButton</button>
</screen>

 

If user press softright or softleft, myButtonAction is called.

Global Shortcut

If you want to realize global shortcut, you can specify which action will be done when a key event corresponds :

<screen title="Kuix Key example">
    <button shortcuts="5=myButtonAction">myButton</button>
</screen>

 

The key 5 will call myButtonAction as the widget shortcut. The advantage, here, is that every widgets can register the key (button, text, screen etc...).
It could allow to bind a quick exit of the application. You can either do multiple shortcuts as well. for example:

<screen shortcuts="0=exit|delete=exit">
    <!-- application widgets -->
</screen>

 

You can merge global shortcut with widget shortcut:

<screen title="Kuix Key example">
    <button onAction="myButtonAction" shortcuts="softright|0=exit">myButton</button>
</screen>

 

the softright key is a widget shortcut (calling muButtonAction) and 0 key is global shortcut.

Different shortcut usage

The action could be called in different type of key event: pressedshortcuts, releasedshortcuts, repeatedshortcuts.
shorcuts is equal to pressedshortcuts. It's just a quicker way to write it.
releasedshorcuts call actions when the key is released (while the key is down, nothing is done).
repeatedshortcuts is called in loop while the key is down.