![]() UJML Language Reference |
Function keys are special purpose buttons on a device, with an associated label.
Normally an onSelect event must be associated with a visual element. See Selection Events, Visual Elements, onSelect Event. Function keys are a specialized way of capturing a button press without a visual element, other than the function key label. Function key events are defined using an event element inside of an fn element. See event, fn.
The fn element defines a function key for a device. On supported devices, you can specify the text for label associated with the function key (most devices display the label in an area of the device screen no otherwise accessible by UJML). You can also tie an event element to the function key to capture user interaction. See Handling Events, event, fn. The accelerator key element for the event specifies which function key is defined.
Only Function 1 (F1) and Function 2 (F2) keys are supported. UJML does not support higher-numbered function keys even if they are available on the device. See Key Codes.
The following example shows how to exit the application if the user clicks the F1 function key. It is part of the helloworld2.ujml sample.
<fn>
<text>Back</text>
<event name="onSelect">
<accelerators>
<key>F1</key>
</accelerators>
<script>_unload();</script>
</event>
</fn>
The following example shows how to link to a separate partition if the user clicks the F2 function key. It is part of the visualelements.ujml sample.
<fn>
<text><eval>mSettingsLabel</eval></text>
<event name="onSelect">
<accelerators>
<key>F2</key>
</accelerators>
<script>_link(mSettingsLabel, mSettingsURL);</script>
</event>
</fn>|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|