TextEdit creates a simple text editor.
Example - Using OnChange
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
edt = app.CreateTextEdit( "Edit me", 0.8, 0.3 );
edt.SetOnChange( edt_OnChange );
lay.AddChild( edt );
txt = app.CreateText( "", 0.8, 0.3 );
txt.SetMargins( 0, 0.02, 0, 0 );
lay.AddChild( txt );
app.AddLayout( lay );
}
function edt_OnChange()
{
txt.SetText( edt.GetText() );
}
Example - Blue on White
function OnStart()
{
lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
edt = app.CreateTextEdit( "Hello", 0.8, 0.4 );
edt.SetTextColor( "#ff6666ff" );
edt.SetBackColor( "#ffffffff" );
lay.AddChild( edt );
app.AddLayout( lay );
}
The following methods are avaiable on the TextEdit 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
?
ClearHistory for undo or redo
destroys object
destroys object with explode animation and sound
?
get height in pixels
get width in pixels
GetCursorLine
GetCursorPos
get screen relative height
returns text formatted with str_html tags
get distance to left parent border
GetLineCount
number - integer
returns position where given line starts
GetMaxLines
GetSelectedText
GetSelectionEnd
GetSelectionStart
GetText
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
Redo action
?
ReplaceText
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
SetCursorColor
SetCursorPos
boolean
en/disable object
set grey default text which cannot be edited
allows using str_html formatting
move object from current position
function()
called when text content changed
function()
called when pressedstr-Done key(disables line break enter key)
called when user touches object
set surrounding borders
SetPosition
number - factor
SetScale
SetSelection
change object size
SetText
SetTextColor
SetTextSize
string - "Show" or "Hide" or "Gone"
change visibility mode
Set visibility "Show"
?
Undo action
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 ]
}