Text creates a Text object.
Example - Single line
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
txt = app.CreateText( "Hello" );
txt.SetTextSize( 22 );
lay.AddChild( txt );
app.AddLayout( lay );
}
Example - Multi line
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
txt = app.CreateText( "Hello\nWorld", 0.8, 0.2, "Multiline" );
txt.SetTextSize( 12 );
txt.SetTextColor( "#ff6666ff" );
txt.SetBackColor( "#ffffffff" );
lay.AddChild( txt );
app.AddLayout( lay );
}
Example - Ellipsize
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
txt = app.CreateText( "The quick brown fox jumps over the lazy dog", 0.75 );
txt.SetTextSize( 28 );
txt.SetEllipsize( "end" );
lay.AddChild( txt );
app.AddLayout( lay );
}
The following methods are avaiable on the Text object:
GetPosition(
options ) ->
object - { left: fraction of parent width, top: fraction of parent height, right: fraction of parent width, bottom: fraction of parent height }
string
number - fraction of screen width
number - fraction of screen height
unknown
number
set color effects
?
destroys object
destroys object with explode animation and sound
?
get height in pixels
get width in pixels
get screen relative height
return text formatted with str_html tags
get distance to left parent border
GetLineCount
number - integer
return number of character where a given line starts
?
GetMaxLines
GetTextSize
get distance to upper parent border
GetVisibility
get screen relative width
Set visibility "Gone"
Set visibility "Hide"
IsEnabled
app object
return wether obj overlap with an other
IsVisible
append text with line break
?
string -
hexadecimal: "#rrggbb", "#aarrggbb"
colourName: "red", "green", ...
SetBackColor
SetBackColorRadial
string - path to file or folder ( "/absolute/..." or "relative/..." )
changes the background image
string - "Add" or "Multiply" or "?"
adjust color
?
boolean
en/disable object
change font style
string - html
allows using str_html tags for formatting
SetLog
move object from current position
callen when object long pressed
called when user touches object
called when finger comes down
called when finger was moved over screen
called when finger leaves screen
set surrounding borders
SetPosition
number - factor
SetScale
change object size
SetText
SetTextColor
SetTextShadow
SetTextSize
SetTouchable
string - "Show" or "Hide" or "Gone"
change visibility mode
Set visibility "Show"
?
object id
{
source:
app object,
action:
string - "Down" or "Move" or "Up",
count:
number - integer,
X:
number - fraction of screen width,
Y:
number - fraction of screen height,
x:
list - [
x1,
x2,
x3 ],
y:
list - [
y1,
y2,
y3 ]
}