Text Widgets
This section describes properties that are common to all widgets that can display text.
- Formatted text elements are single-line only (there are no built-in multiline text elements. Custom implementations are possible using refloat or CANVAS). See TextWidget.
- The font, text decoration & color properties are by default inherited from the parent cell. It can be overridden for this particular text cell.
- The total element size is by default automatically computed, taking the font and selected text to display into account. But the size can be forced (use the cell width & height attributes).
Attributes brief detailed show all inherited
Examples
Display a simple single line text field with inherited font properties: the first line inherits from the global skin settings, and the second one from the global + cell settings.

- <?xml version="1.0" encoding="utf-8" ?>
- <SKIN background_color="#000000" margin="15" spacing="4" font_face="Tahoma" font_size="16" text_color="#ffffff">
- <TEXT value="I'm here to say..." />
- <ROW font_size="25" spacing="5" text_color="#AAFF00">
- <TEXT value="Hello" text_color="#00AAFF" />
- <TEXT value="World!" />
- </ROW>
- </SKIN>
Note About Special Characters
In order to display special characters you need to use their HTML codes, as the XML norm specifies it. See http://www.w3.org/MarkUp/html-spec/html-spec_13.html for special character codes reference.

- <TEXT value="Rotate 90°" font_escapement="90" />
Accessing text params on the fly
Every final widget that can do text exposes color (widget.text_color.r,g,b) and font_size, face_name, font_weight, font_style. So you can read/write those attributes on the fly.
- <!-- demo text -->
- <TEXT id="my_text" value="Hello, World!" font_size="20" background_color="#FFFFFF" />
- <!-- text controls -->
- <WIDGET background_color="#EEEEEE" spacing="5" margin="10">
- <ROW spacing="10">
- <TEXT value="Text RGB: " />
- <PARAM_TEXT_CONTROL param_id="my_text.text_color.r" />
- <PARAM_TEXT_CONTROL param_id="my_text.text_color.g" />
- <PARAM_TEXT_CONTROL param_id="my_text.text_color.b" />
- </ROW>
- <ROW spacing="10">
- <TEXT value="BG RGB: " />
- <PARAM_TEXT_CONTROL param_id="my_text.background_color.r" />
- <PARAM_TEXT_CONTROL param_id="my_text.background_color.g" />
- <PARAM_TEXT_CONTROL param_id="my_text.background_color.b" />
- </ROW>
- <ROW spacing="10">
- <TEXT_FIELD string_id="my_text.font_face" />
- <PARAM_TEXT_CONTROL param_id="my_text.font_size" />
- <PARAM_TEXT_CONTROL param_id="my_text.font_weight" />
- <PARAM_TEXT_CONTROL param_id="my_text.font_style" />
- </ROW>
- </WIDGET>

Descendent elements
Comments
Please, authorize to view and post comments.