A skinnable text input handler.
Supports text selection, keyboard cursor navigation, as well as basic hotkeys: Ctrl + Z
, Ctrl + Y
for undo and redo and Ctrl + A
to select all text.
Static methods
Constructor
new(font:Font, ?parent:Object)
Create a new TextInput instance.
Parameters:
font | The font used to render the text. |
---|---|
parent | An optional parent |
Variables
backgroundColor:Null<Int>
If set, TextInput will render provided color as a background to text interactive area.
canEdit:Bool = true
When disabled, user would not be able to edit the input text (selection is still available).
cursorIndex:Int = -1
Current position of the input cursor. When TextInput is not focused value is -1.
inputWidth:Null<Int>
Maximum input width.
Contrary to Text.maxWidth
does not cause a word-wrap, but also masks out contents that are outside the max width.
selectionTile:Tile
The Tile used to render the background for selected text. When rendering, this Tile is stretched horizontally to fill entire selection area.
Methods
getSelectedText():String
Returns a String representing currently selected text area or null
if no text is selected.