This page contains a quick tutorial that shows how to write a simple texte editor.
The toolkit provides several view renderers that performs the lay out of the children of the widgets they are associated to. In the current version, these renderer make it possible to create:
The box layout model works as follows:
uhbox( uleft() + a + b + uhflex() + x + y + uright() + c + d )
uleft(), uhflex(), uright() (and uhcenter()) specify how the following objects are displayed. Objects after uhflex() are "flexible" . This means that their size is automatically adjusted to the size of the parent object. These specifications can be combined with their vertical counterparts: utop(), uvflex(), uvcenter(), ubottom(). This mechanism makes possible to specify a large variety of layout behaviors in a rather simple way.
The size of objects can be specified in the following way:
uhbox( scale + uwidth(200) + uheight(300) + etc... )
this size is relative and depends on the value of the scale object (sizes are nominal if the scale == 0, larger if the scale is > 0, smaller if it is < 0). The size of the "flexible" children is automatically adjusted.
Tables can be used to specify more complex layouts:
utable( utrow( a + b + c ) + utrow( x + y + z ) + utrow( utcell(2,1, w) + t) ) example: **a** *b* ***c*** **x** *y* ***z*** *****w**** ***t***
all objects are then adjusted inside a virtual grid. Widget "w" occupies 2 columns (and 1 row).
The flow layout provides a simple way to create pages that contain arbitrary objects (textual elements can be combined with widgets, images, graphical symbols, etc.)
uflowbox( UColor::blue + "abcd efg" + uima("whatever.gif") UColor::red + UFont::large + "xyz tuv" + any_widget )
The flow layout (as other layout styles) can be applied to any widget:
ubutton( UFlowView::style + etc... )
In constrast with other layout styles, the Flow layout will automatically split strings into several subparts according to the size of the corresponding widget. For instance, if the previous "button" has a very small width, the two strings it contains will be splitted into subparts shown on separate lines (while other children will be clipped)
All layout style support text editing, even in a flow:
ubutton( uedit() + UFlowView::style + etc... )
Widgets can also be located at arbitrary locations:
uhbox( uleft() + a + uhflex() + x + SSS + uright() + d + WWW)
SSS and WWW will not follow the previous layout specifications if they contain an upos() object:
SSS = ubutton( upos(30, 50) + etc... )
This upos object specify the relative location of SSS by reference to its parents (as SSS can possibily have several parents). The scale of the parents is taken into account when calculating the actual locations of the children.