Saturday, February 04, 2006

UIEngine "Listens" to User Input

Use the <event name="onselect"> tag to capture key presses and mouse/stylus clicks/taps.


<?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" []>

<ujml>
<application>
<!-- paint background -->
<display>
<box>
<width>
<eval>_getIntProperty(&_PROPERTY_INT_SCREEN_WIDTH;)</eval>
</width>
<height>
<eval>_getIntProperty(&_PROPERTY_INT_SCREEN_HEIGHT;)</eval>
</height>
<bg>&_COLOR_BLACK;</bg>
</box>
<!-- draw text -->
<label>
<text>Hello World!</text>
<fg>&_COLOR_YELLOW;</fg>
<!-- wait for keypress or mouse click -->
<event name="onselect">
<accelerators>
<key>FIRE</key>
</accelerators>
<script>
// User pressed FIRE or clicked on label
</script>
</event>
</label>
</display>
</application>
</ujml>


Learn more about UIEvolution's UIEngine.

No comments: