haXe Book : a sample UI
I have recently completed a new Chapter of the forthcoming book. One of the topics of the Chapter is creating a User Interface with the following requirements:
- Platform Independence and Isolation: the haXe nature to be a multi-target environment must be respected. This implies also isolating the mouse and keyboard events from the target system.
- Lightweight: the library must have a reduced footprint in terms of bytes; it must be loaded and displayed fast.
- Basic Set of Controls: buttons, text-inputs and labels are the very bare minimum required to build interaction.
- Easy Positioning: Some UI API delegate to the developer the responsibility to manage and dispose the controls. Although it is important to have the freedom to create accurate pixel-perfect positioning, in the majority of cases it is more important to be able to dispose the controls easily and let the arrangement issues to the system. A set of containers is implemented to ease the visual layout process.
- Visually Appealing: controls must be nice. Products developed with poor graphic are very often labeled as “unprofessional” works independently from their functionalities. Sad but true.
- Visually Configurable: the aspect of the controls muse be easily customizable.
The implementation is necessarily simple (or simplified) and many can be added and/or corrected. I would like to hear your opinion about the topic and the implementation.
Sample (simple) application: TreeEditor [swf]

Placing Controls in a Grid [swf]:

Anchoring Controls to Margins [swf]:

Source code and examples: ui.zip version 0.0.1
comments (9)



