![]() UJML Language Reference |
An application file contains a standalone UJML application.
Application files have a file extension of '.ujml', for example 'foo.ujml'. An application file contains a ujml root element, which contains an application element. See Layout of UJML Files, ujml, application. If the application uses any components, the ujml root element may also contain an interfaces element with references to the component interfaces used. See Components, Interfaces.
Application files are compiled to byte code. See Byte Code Files. A compiled application is loaded by the device operating system or by another UJML application calling the _run() or _replace() functions. See Running Files, _run() function, _replace() function. The application then runs until it calls the _unload() or _unloadSelf() function. See _unload() function, _unloadSelf() function.
Applications files may include other files, meaning that the contents of those files are copied into the application file when it is compiled and become part of the resulting byte code for that file. See Including Files.
The following example shows how to display the phrase 'Hello World!' inside of a box until the user clicks the 'F2' button. It is part of the helloworld2.ujml sample.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ujml PUBLIC "-//UIEVOLUTION//DTD UJML 1.5//EN"
"http://www.uievolution.com/dtd/ujml-1.5.dtd" [
<!ENTITY SALUTATION "Hello World!">
<!ENTITY SPACING "4">
]>
<ujml>
<application>
<display>
<box>
<!-- Draw the screen black. -->
<width>
<eval>_getIntProperty(&_PROPERTY_INT_SCREEN_WIDTH;)</eval>
</width>
<height>
<eval>_getIntProperty(&_PROPERTY_INT_SCREEN_HEIGHT;)</eval>
</height>
<bg>&_COLOR_BLACK;</bg>
</box>
<!-- Say Hello on the screen using a label inside of a box. -->
<round-box>
<x>20</x>
<y>20</y>
<width>
<eval>
(&SPACING; * 2) +
_text_width("&SALUTATION;", &_FONT_SIZE_LARGE;, &_FONT_STYLE_ITALIC;,
&_FONT_FACE_SYSTEM;)
</eval>
</width>
<height>
<eval>
(&SPACING; * 2) +
_text_height(&_FONT_SIZE_LARGE;, &_FONT_STYLE_ITALIC;, &_FONT_FACE_SYSTEM;)
</eval>
</height>
<fg>&_COLOR_SILVER;</fg>
<bg>&_COLOR_RED;</bg>
<x-arc-width>8</x-arc-width>
<label>
<text>&SALUTATION;</text>
<x>&SPACING;</x>
<y>&SPACING;</y>
<fg>&_COLOR_WHITE;</fg>
<size>&_FONT_SIZE_LARGE;</size>
<style>&_FONT_STYLE_ITALIC;</style>
<face>&_FONT_FACE_SYSTEM;</face>
</label>
</round-box>
<!-- If the user presses 'Back' unload the application. -->
<fn>
<text>Back</text>
<event name="onSelect">
<accelerators>
<key>F1</key>
</accelerators>
<script>_unload();</script>
</event>
</fn>
</display>
</application>
</ujml>|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|