Skip to main content

Input Field

YauiInputField is an editable text. It shows its text in a YauiText, with a caret and a selection, and supports:

  • Keyboard editing, with the clipboard
  • IME composition
  • The on-screen keyboard of mobile platforms

Selecting the input field starts editing. Enter (in a single line field), Escape, or deselecting it ends editing.

Setup​

InputField YauiElement (the frame), YauiInputField
└─ TextArea YauiElement (ClipChildren)
├─ Placeholder YauiText
└─ Text YauiText (the TextComponent)

The input field creates the caret and the selection as elements next to the text, in its parent (they are not saved). Make that parent clip its children (ClipChildren), so that long texts scroll inside it.

Properties​

MemberDescription
TextThe text. SetTextWithoutNotify changes it without invoking OnValueChanged.
TextComponentThe YauiText that shows the text
PlaceholderShown while the text is empty (the input field drives its opacity)
CharacterLimitThe maximum number of characters, or 0 for no limit
LineTypeSingleLine, MultiLineSubmit (wraps, Enter submits) or MultiLineNewline (wraps, Enter starts a new line)
ContentTypeStandard, IntegerNumber, DecimalNumber, Alphanumeric or Password (shown as asterisks, not copied)
KeyboardTypeThe type of the on-screen keyboard
ReadOnlyWhether the text can be selected but not changed
SelectAllOnFocusWhether the whole text is selected when editing starts
CaretColor, CaretWidth, CaretBlinkRate, SelectionColorThe look of the caret and the selection

Events​

EventInvoked
OnValueChangedWhen the text changes
OnEndEditWhen editing ends
OnSubmitTextWhen Enter (or Done on the on-screen keyboard) ends editing

Scripting​

MemberDescription
ActivateInputField(), DeactivateInputField()Starts and ends editing
IsFocusedWhether the field is being edited
CaretPosition, SelectionAnchorThe caret and the other end of the selection, as character indices
SelectAll(), SelectedTextSelects the whole text, and the selected text
note

Caret positions come from the text selection service of ATG. Without it, the field still edits text, but without a caret.