Back

CreateTextEdit

TextEdit creates a simple text editor.

app.CreateTextEdit( text, width, height, options ) -> app object - TextEdit

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() );
}
    Copy     Copy All       Run      

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 );
}
    Copy     Copy All       Run      

The following methods are avaiable on the TextEdit object:

  Destroy()
  Explode()
  Focus()
  GetAbsHeight() -> number - integer
  GetAbsWidth() -> number - integer
  GetCursorLine() -> number - integer
  GetCursorPos() -> number - integer
  GetHeight( options ) -> number - fraction of screen height
  GetHtml() -> string - html
  GetLeft( options ) -> number - fraction of screen width
  GetLineCount() -> number - integer
  GetLineStart( line ) -> number - integer
  GetLineTop( line ) -> unknown
  GetMaxLines() -> number - integer
  GetPosition( options ) -> object - { left: fraction of parent width, top: fraction of parent height, right: fraction of parent width, bottom: fraction of parent height }
  GetSelectedText() -> string
  GetSelectionEnd() -> number - integer
  GetSelectionStart() -> number - integer
  GetText() -> string
  GetTextSize( mode ) -> number - integer
  GetTop( options ) -> number - fraction of screen height
  GetType() -> string - "TextEdit"
  GetVisibility() -> string - "Show" or "Hide" or "Gone"
  GetWidth( options ) -> number - fraction of screen width
  Gone()
  Hide()
  IsEnabled() -> boolean
  IsOverlap( obj, depth ) -> boolean
  IsVisible() -> boolean
  Redo()
  Release()
  SetScale( x, y )
  SetText( txt )
  Show()
  Undo()
  id -> string - "#id"

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)
function( event )
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 ]
}