Back

CreateTESearchElegant

Hello World
Content:
- Methods

Creates a customizable elegant text input.

tes = MUI.CreateTESearchElegant( width, hint, icon, iconPos, color, option ) → Object

Basic implementation.

Example - Basic

cfg.Light
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "VCenter,FillXY")

        tef = MUI.CreateTESearchElegant(0.8, "Search for music", "music_note")
        lay.AddChild(tef)

    app.AddLayout(lay)
}
Copy All       Run      

By default icon is displayed on the left, you can place the icon to the right by passing Right to the iconPos argument.

Example - RightIcon

cfg.Dark
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "VCenter,FillXY")

        tef = MUI.CreateTESearchElegant(0.8, "Search for music", "music_note", "Right")
        lay.AddChild(tef)

    app.AddLayout(lay)
}
Copy All       Run      

To make a smaller input, just pass small to the option argument.

Example - Small

cfg.Light
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "VCenter,FillXY")

        tef = MUI.CreateTESearchElegant(0.8, "Search for music", "music_note", "Right", "#673ab7", "Small")
        lay.AddChild(tef)

    app.AddLayout(lay)
}
Copy All       Run      

To make a bordered input, you can pass border to the option argument.

Example - Border

cfg.Dark
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "VCenter,FillXY")

        tef = MUI.CreateTESearchElegant(0.8, "Search for music", "music_note", "Right", null, "Small,Border")
        lay.AddChild(tef)

    app.AddLayout(lay)
}
Copy All       Run      

Methods

The following methods are available on the TESearchElegant object:

Focus()
GetCursorLine() → Number
GetText() → String
GetType() → String
GetVisibility() → String: “Show” or “Hide” or “Gone”
Gone()
IsEnabled() → Boolean
IsOverlap( obj, depth ) → Boolean
IsVisible() → Boolean
Redo()
Undo()
app object
Number
String
Number: fraction (0..1)
Number: integer
String:
  hexadecimal: “#rrggbb”, “#aarrggbb”
  colourName: “red”, “green”, ...
String: “Hint text”
String: “Material icon font”
String: “Right” or “Left”
String: “Small” or “Normal” or “Border”
String: “px” or “sp” or “dip” or “mm” or “pt”
String: “px”
function()
tes.ClearFocus
Removes the focus of the control so that the user no longer has immediate access to it.
tes.ClearHistory
Clear input history
tes.Focus
Set the focus to the control so that the user can interact with it immediately.
tes.GetCursorLine
Get cursor line
tes.GetCursorPos
Get cursor position
tes.GetSelectedText
Get selected text
tes.GetSelectionEnd
Get selection end
tes.GetSelectionStart
Get selection start
tes.GetText
Returns the current displayed text of the control.
tes.GetType
Get the type of MUI control.
tes.GetVisibility
Returns the current visibility state of the control. The Values are:
Show: visible
Hide: invisible but still consuming space
Gone: invisible and not consuming space
tes.Gone
Hides the control without consuming any more layout space as if it were never there.
tes.InsertText
Inserts a string at a given position.
tes.IsEnabled
Returns whether the control is currently useable by the user.
tes.IsOverlap
Returns whether the control overlaps with another by a given distance.
tes.IsVisible
Returns whether the control is currently visible to the user, ignoring overlaying controls.
tes.Redo
Redo an undone action.
tes.ReplaceText
Replaces a given range in the text with some string.
tes.SetCursorPos
Change the curernt cursor position.
tes.SetIconOnTouch
Define a callback function which is called when the user pressed the icon.
tes.SetMargins
Define a distance to other controls on each side of the control.
tes.SetOnChange
Called when the containing data has been changed by the user.
tes.SetOnEnter
Define a callback function which is called when the user pressed 'Done' or 'Enter' on the keyboard
tes.SetOnIconTouch
Calls a function when icon is touch
tes.SetOnTouch
Define a callback function that is called when the user touches the control.
tes.SetPosition
Defines the position and size for the control if the parent is an absolute layout.
tes.SetText
Change the currently displayed text in the control.
tes.Undo
Undo an action