TextElement
The TextElement define text in the layout. You can define the color, the size, a specific style,
its position. You can define also a clickable text and an associated function, a color and a
background color when the mouse is over the text. You can used i18n with TextElement.
A specific feature can be used to define an html encoded data in TextElement.
Clickable TextElement
...
var aText = new TextElement("Text");
aText.setColor("#000000")
.setMouseOverColor("#FF0000")
.setMouseOverBkColor("#000000")
.onClick(function() \{ alert("Text Clicked");} );
...
Top Centered TextElement
...
var aText = new TextElement("Text");
aText.setPosition("center")
.setVerticalPosition("top");
...
i18n
To use internationalization, the translate() method will help you. You have to define an i18n file, to be loaded in
the internationalization library. this library is loaded with QDLayout project.
If you define this i18n file :
\{
"fr": \{
"FRENCH" : "FranÇais"
}
,
"en": \{
"FRENCH" : "French"
}
}
You can define this code and change the language during the web page display:
International.load("./res/international.json");
var aText = new TextElement("Text");
aText.translate("FRENCH");
aText.insert("#text");
Layout.setLanguage("fr");
{r:desc:./res/text/elements/text2.html}Next>>{:}