behavior: edit

Standard single line input element behavior. This behavior can be applied to any element that has flow:text and white-space:pre model.

Elements

that have this behavior applied by default:

Attributes

that this behavior knows about:

Events

Together with the standard set of events (mouse, keyboard, focus) behavior: button generates:

Value

string, reflects current status of internal editing buffer.

Special key combinations

Methods

canUndo
(): true|false - returns true if undo buffer is not empty.
doUndo
(): true|false - discards last change in edit box, returns true if changes were made.
canRedo
(): true|false - returns true if redo buffer is not empty.
doRedo
(): true|false - applies last change, returns true if changes were made.
canCut
(): true|false - returns true if selection exists and the element is not readonly.
doCut
(): true|false - removes characters in selection and puts them into the clipboard, returns true if changes were made.
canCopy
(): true|false - returns true if selection exists.
doCopy
(): true|false - copies characters in selection to the clipboard, returns true if changes were made.
canPaste
(): true|false - returns true if the clipboard contains text.
doPaste
(): true|false - inserts characters from the clipboard at current caret position, returns true if changes were made.
canSelectAll
(): true|false - returns true if the element is not empty.
doSelectAll
(): true|false - selects all characters in the edit box, returns true if changes were made.
selectionStart
(): integer -  returns start position of the selection, or caret position if there is no selection.
selectionEnd
(): integer -  returns end position of the selection, or caret position if there is no selection.
selectionText
(): string - returns selected text or empty string if there is no selection.
setSelection
(anchorPos: integer, caretPos: integer) -  selects text in the edit box. If anchorPos == caretPos then edit box will not contain any selection and caret will be set at that position.
insertText
(text:string) - inserts the text at current caret position, moves caret to the end of the text.
appendText
(text:string) - appends the text to current content of the edit box, moves caret to the end.