Classes
AddedRemovedEvent
AlertElement
AnchorContainerElement
ArrowShape
ButtonElement
CanvasElement
CanvasManager
CheckboxElement
CheckboxSkinElement
CollectionChangedEvent
CollectionSort
ColorPickerButtonElement
ColorPickerElement
ContainerBaseElement
CursorDefinition
DataGridColumnDefinition
DataGridDataRenderer
DataGridElement
DataGridHeaderColumnDividerSkinElement
DataGridHeaderElement
DataGridHeaderItemRenderer
DataGridItemData
DataGridItemRendererBase
DataGridLabelItemRenderer
DataListData
DataListElement
DataRendererBaseElement
DataRendererLabelElement
DatePickerButtonElement
DatePickerElement
DispatcherEvent
DrawMetrics
DropdownArrowButtonSkinElement
DropdownBaseElement
DropdownElement
ElementEvent
ElementGridItemClickEvent
ElementKeyboardEvent
ElementListItemClickEvent
ElementMouseEvent
ElementMouseWheelEvent
EllipseShape
EventDispatcher
FillBase
GridContainerElement
GridContainerRowColumnDefinition
ImageElement
IpInputElement
LabelElement
LinearGradientFill
ListCollection
ListContainerElement
ProgressElement
RadioButtonElement
RadioButtonSkinElement
RoundedRectangleShape
ScrollBarElement
ScrollButtonSkinElement
ShapeBase
SkinnableElement
SolidFill
StyleableBase
StyleChangedEvent
StyleData
StyleDefinition
StyleProxy
TextAreaElement
TextElement
TextFieldElement
TextInputElement
TimeInputElement
ToggleButtonElement
ToggleButtonGroup
Tween
ViewportElement


TextFieldElement

Internal class used for consistently rendering text used by controls like TextElement, TextInput, and TextArea.
You typically should not use this class directly it is designed to be wrapped by a higher level control.
This class allows text to be selected and edited, it renders a text position caret, watches
focus/mouse/keyboard events, maintains position of individual characters, and allows copy/cut/paste.
TextField also normalizes text width. The canvas natively will give
different widths for strings than when measuring and adding character widths
which will not work for highlighting or editing.

Inheritance:     TextFieldElement ➞ CanvasElementStyleableBaseStyleDefinitionEventDispatcher ➞ Object

Styles
Show Inherited
Style Defined By
MaskCharacter     :    String TextFieldElement
When not null, all characters are replaced with the MaskCharacter.
 
MaxChars     :    int TextFieldElement
The maximum number of characters allowed for this TextField. When 0 unlimited characters are allowed.
 
Multiline     :    boolean TextFieldElement
When true, newline characters are respected and text will be rendered on multiple lines if necessary.
 
Selectable     :    boolean TextFieldElement
When true, the text can be highlighted and copied.
 
WordWrap     :    boolean TextFieldElement
When true, text will wrap when width is constrained and will be rendered on multiple lines if necessary.
 


Events
Show Inherited
Event Defined By
changed     :    ElementEvent TextFieldElement
Dispatched when the text is changed due to user interaction.
 


Public Functions
Show Inherited
Function Defined By
TextFieldElement() [Constructor] TextFieldElement
Creates new TextFieldElement instance.
 
getSelection() TextFieldElement
Gets the current text selection or text caret position.
  returns     :    Object
Object containing the start and end selection indexes. {startIndex, endIndex}
 
getText() TextFieldElement
Gets the current text string.
  returns     :    String
Current text string.
 
setSelection(startIndex, endIndex) TextFieldElement
Sets the text selection or text caret position. When startIndex and endIndex are the same
it places the text caret at that position, when different, it selects / highlights that range of characters.
  startIndex     :    int
Character index to begin the selection.
  endIndex     :    int
Character index to end the selection.
 
setText(text) TextFieldElement
Sets the text string to be rendered.
  text     :    String
Text string to be rendered
 


Internal Members
Show Inherited


Internal Functions
Show Inherited
Function Defined By
_createTextCaret() TextFieldElement
Generates a CanvasElement to be used as the text caret.
  returns     :    CanvasElement
New CanvasElement instance to be used as the text caret.
 
_getCaretIndexFromMouse(mouseX, mouseY) TextFieldElement
Gets the position to place the text caret based on the position of the mouse.
  mouseX     :    Number
Current X position of the mouse.
  mouseY     :    Number
Current Y position of the mouse.
  returns     :    int
Corresponding caret character index.
 
_getHorizontalScrollParameters() TextFieldElement
Returns parameters representing the vertical scroll page, view, line, and value sizes.
  returns     :    Object
An object containing both width and height: {page:100, view:100, line:14, value:0}
 
_getLineIndexFromCharIndex(charIndex) TextFieldElement
Gets the line index from the supplied character index.
  charIndex     :    int
Character index to get the line index from.
  returns     :    int
Corresponding line index.
 
_getLineRangeFromCharIndex(charIndex) TextFieldElement
Returns the exclusive range of character indexes for the current line the character is included in.
  charIndex     :    int
Character index to return line range for.
 
_getVerticalScrollParameters() TextFieldElement
Returns parameters representing the vertical scroll page, view, and line sizes.
  returns     :    Object
An object containing both width and height: {page:100, view:100, line:14}
 
_getWordRangeFromCaretIndex(charIndex) TextFieldElement
Returns the exclusive range of character indexes for the current word the character is included in.
If the character is a space, a block of spaces will be returned.
  charIndex     :    int
Character index to return word range for.
 
_onTextFieldCopy(clipboardData) TextFieldElement
Event handler for native browser "copy" event. Copies selected text to clipboard.
  clipboardData     :    BrowserClipboard
The browser clipboard object to copy text too.
 
_onTextFieldCopy(clipboardData) TextFieldElement
Event handler for native browser "paste" event. Pastes clipboard text into TextField.
  clipboardData     :    BrowserClipboard
The browser clipboard object to copy text from.
 
_onTextFieldCut(clipboardData) TextFieldElement
Event handler for native browser "cut" event. Copies selected text to clipboard and deletes from TextField.
  clipboardData     :    BrowserClipboard
The browser clipboard object to copy text too.
 
_onTextFieldKeyDown(keyboardEvent) TextFieldElement
Event handler for "keydown" event. Only active when TextField is enabled and focused.
Handles editing and cursor navigation / selection.
  keyboardEvent     :    ElementKeyboardEvent
ElementKeyboardEvent to process.
 
_onTextFieldKeyUp(keyboardEvent) TextFieldElement
Event handler for "keyup" event. Only active when TextField is enabled and focused.
Handles editing and cursor navigation / selection.
  keyboardEvent     :    ElementKeyboardEvent
ElementKeyboardEvent to process.
 
_setHorizontalScrollValue(value) TextFieldElement
Sets the horizontal scroll position.
  value     :    int
X position to scroll too
 
_setVerticalScrollValue(value) TextFieldElement
Sets the vertical scroll position.
  value     :    int
Y position to scroll too
 
_updateEventListeners() TextFieldElement
Adds removes mouse, keyboard, and focus event listeners based on Enabled and Selectable styles.
Called in response to style changes.