Skip to content
Marcus Mascord edited this page Jul 14, 2014 · 7 revisions

The text widget displays text.

The attributes for the text widget are the following:

Attributes Type Description
m Widget The main widget class.
text String The actual text to be displayed.
s WidgetStyle The style of the widget. Only the Colour attribute is used, the other attributes are ignored.
font String This is the font type face like "Arial". Depending on the OS, this may be ignored and the best fit may be found.
fontType String This can be "bold", "italic" and "normal". "normal" is the default.
textBaseLine String This is the baseline for the font can be "hanging", "middle", "top", "alphabetic", "ideographic", "bottom". The default is "top".
vertical Boolean If this is true, the text will be displayed vertically. If this is fault the text is shown horizontally. The default is false.
fontsize Integer This is the font size of the text.

XML Text Widget Example

This is an example of the Text Widget written in XML:

<Widget>
    <Id>HelloWorldText</Id>
    <Class>Text</Class>
    <L>1</L>
    <Style>
        <Colour>#000000</Colour>
     </Style>
     <Font>Arial</Font>
     <FontSize>14</FontSize>
     <AlignHoz>CENTER</AlignHoz>
     <AlignVert>CENTER</AlignVert>
     <Text>Hello World!</Text>
</Widget>

In this example the <Text> tag has been used. The text has been hardcoded. Instead of hardcoding the text it is possible to set up a messages file for each language. Here is an example of an English message file called "messages_en.xml":

<?xml version="1.0" encoding="UTF-8"?>
<Message>
    <MessageSection>
        <Id>Main</Id>
        <Messages>
            <M id="MSG_HELLO_WORLD">Hello World!</M>
        </Messages>
    </MessageSection>
</Message>

Now instead of using the <Text> tag in the XML file, use the <Message> tag and it will be retrieved from the correct messages file. An example is:

<Widget>
    <Id>HelloWorldText</Id>
    <Class>Text</Class>
    <L>1</L>
    <Style>
        <Colour>#000000</Colour>
     </Style>
     <Font>Arial</Font>
     <FontSize>14</FontSize>
     <AlignHoz>CENTER</AlignHoz>
     <AlignVert>CENTER</AlignVert>
     <Message>MSG_HELLO_WORLD</Message>
</Widget>
Clone this wiki locally