TextEditBox

Node class that displays typed characters with a flashing cursor

Extends Group

The TextEditBox node class is intended to display a string of characters as they are typed. When focused, it displays a flashing cursor to indicate the text insertion position.

TextEditBox nodes are automatically included in the Keyboard and MiniKeyboard node classes.

The default appearance of the TextEditBox is very transparent, allowing it to pick up most of its color from what is rendered underneath it. The appearance can be customized by changing the backgroundUri and other fields.

Fields

FieldTypeDefaultAccess PermissionDescription
textstring""Read-WriteContains the string of characters being displayed.
hintTextstring""Read-WriteSpecifies a string to be displayed if the length of the text field string is zero. The typical usage of this field is to prompt the user about what to enter (such as, "Enter your WiFi password").
maxTextLengthinteger15Read-WriteSpecifies the maximum length of the string that can be displayed. When used internal to the Keyboard node, maxTextLength is initialized to 75. When used in the MiniKeyboard node, maxTextLength is initialized to 25.
cursorPositioninteger0Read-WriteBy default, this is set to the length of the text field, indicating that the next character to be entered should be appended at the end of the string. When used internal to the Keyboard and MiniKeyboard nodes, those nodes use this field to move the text insertion point.
clearOnDownKeybooleantrueRead-WriteWhen clearOnDownKey is set to true, the textEditBox erases all the characters when down key is pressed (focus does not move down). When set to false, the characters are not erased and focus moves down.
activebooleanfalseRead-Write

When active is set to true, the cursor is displayed.



When set to false, the cursor is hidden.



When used internal to the Keyboard and MiniKeyboard nodes, those nodes set this field to true when the keyboard has focus, and false when it does not.

secureModebooleanfalseRead-Write

When set to true, the characters entered are briefly displayed, then replaced with an asterisk. When set to false, the characters entered are always displayed.



When used internal to the Keyboard and MiniKeyboard nodes, you can access the keyboard textEditBox field to set its secureMode field. For example: myKeyboard.textEditBox.secureMode = true

textColorcolor0xffffffffRead-WriteSpecifies the color of the text string displayed.
hintTextColorcolor0xffffffffRead-WriteSpecifies the color of the hint text string.
widthfloat-1.0Read-WriteSpecifies the width of the TextEditBox node. When used internal to the Keyboard and MiniKeyboard nodes, those nodes set this field to match the width of the keyboard.
backgroundUristring""Read-WriteSpecifies the URI of the image rendered as the background of the TextEditBox node.
leadingEllipsisBooleanfalseREAD_WRITESpecifies whether to display the end or beginning of text that overflows its available width:

  • true. The end of the text is shown. For example, "the quick brown fox jumps over the lazy dog" would be truncated to "...jumps over the lazy dog".

  • false. The start of the text is shown (for example, "the quick brown fox jumps...").

Sample app

TextEditBoxExample is a sample app demonstrating TextEditBox in action.


Did this page help you?