A text input element is used to enter a single line of text. It has a label that displays a prompt text when there is no text written to the text input.
See also:
Constructor
Variables
maxLength:Int = Config.textInputMaxLength
valid:Bool = true
true
if the text value of this TextInput
is valid based on the
regular expression set in validationReg
. If this value is false
, the
text field is highlighted in a different color (theme property
"color_invalid"
).
See also:
validationReg:EReg = null
A regular expression that checks whether the input text is a valid value
for this text input. If null
, no validation check is performed.
See also:
Methods
privategetTextIndexBeforePosition(?searchText:String, ?relPositionX:Null<FastFloat>):Int
Calculates the rightmost text index which position in searchText
is
smaller than relPositionX
with binary search.
If searchText
is not given, this.text
is used instead.
If relPositionX
is not given, the relative mouse position is used
instead.
Parameters:
searchText | The text to be searched |
---|---|
relPositionX | The position in "text coordinates" |
Returns:
Int
insertText(newText:String, position:Int):Void
Insert the given text at the given position. If the position is greater
or equal than the length of the text, newText
is inserted at the
end of the element's current text. If the new text of this element is
greater than maxLength
, the text is truncated.
isTextValid():Bool
Return whether the text value of this element is valid according to the
regular expression stored in TextInput.validationReg
.
privaterecalcScrollBounds(recalcRight:Bool = true):Void
Recalculates one of both scrollBound[L/R]
variables based on the value
of the other variable.
The recalculated variable is determined based on whether recalcRight
is
true
or false
. If it is true
, scrollBoundR
is calculated based on
the value in scrollBoundL
. If it is false
, it is calculated the other
way around.
Parameters:
recalcRight | If |
---|