EditText
Component that enables text editing functionality for Text visuals.
This component provides text input, selection, and editing capabilities when attached to a Text entity. It handles user input, cursor positioning, text selection, and clipboard operations.
Instance Members
entity: TextThe Text entity this component is attached to.
multiline: BoolWhether multiline editing is enabled. When false, pressing Enter will submit the text. When true, pressing Enter will create a new line.
editing: BoolWhether this EditText is currently active and editing.
selectionColor: ColorThe color used for text selection highlighting.
textCursorColor: ColorThe color of the text cursor.
textCursorOffsetX: FloatHorizontal offset for the text cursor position.
textCursorOffsetY: FloatVertical offset for the text cursor position.
textCursorHeightFactor: FloatHeight factor for the text cursor (1.0 = full line height).
textCursorWidth: FloatWidth of the text cursor in pixels.
disabled: BoolWhether text editing is disabled. When disabled, the user cannot edit the text.
container: VisualOptional container on which pointer events are bound
selectText: SelectTextSelectText instance used internally to manage text selection. Will be defined after component has been assigned to an entity.
initializerName: StringStart text input and editing.
| Name | Type | Default | Description |
|---|---|---|---|
selectionStart |
Int | -1 |
Initial cursor position or selection start (-1 for end of text) |
selectionEnd |
Int | -1 |
Selection end position (-1 for no selection) |
stopInput(): VoidStop text input and editing.
Update the text content programmatically while editing.
| Name | Type | Description |
|---|---|---|
text |
String | The new text content |
focus(): VoidGive focus to this text field and start editing. Selects all text by default.
Find the closest position in a target line from a position in another line. Used for vertical cursor navigation.
| Name | Type | Description |
|---|---|---|
fromPosition |
Int | Position in the source line |
fromLine |
Int | Source line number |
toLine |
Int | Target line number |
| Returns | Description |
|---|---|
| Int | Closest position in the target line |
textInputNumberOfLines(): IntGet the total number of lines in the text.
| Returns | Description |
|---|---|
| Int | Number of lines |
Get the global character index from a line number and position within that line.
| Name | Type | Description |
|---|---|---|
lineNumber |
Int | The line number (0-based) |
lineOffset |
Int | Position within the line |
| Returns | Description |
|---|---|
| Int | Global character index |
Get the line number for a given character index.
| Name | Type | Description |
|---|---|---|
index |
Int | Global character index |
| Returns | Description |
|---|---|
| Int | Line number (0-based) |
Get the position within a line for a given character index.
| Name | Type | Description |
|---|---|---|
index |
Int | Global character index |
| Returns | Description |
|---|---|
| Int | Position within the line |
destroy(): Voidnew(selectionColor: Color, textCursorColor: Color, ?textCursorOffsetX: Float = 0, ?textCursorOffsetY: Float = 0, ?textCursorHeightFactor: Float = 1, ?textCursorWidth: Float = 1): VoidCreate a new EditText component.
| Name | Type | Default | Description |
|---|---|---|---|
selectionColor |
Color | Color for text selection highlighting | |
textCursorColor |
Color | Color of the text cursor | |
textCursorOffsetX |
Float | 0 |
Horizontal offset for cursor position |
textCursorOffsetY |
Float | 0 |
Vertical offset for cursor position |
textCursorHeightFactor |
Float | 1 |
Height factor for cursor (1.0 = full line height) |
textCursorWidth |
Float | 1 |
Width of the cursor in pixels |
Private Members
boundContainer: VisualinputActive: BoolwillUpdateSelection: BooltextCursor: QuadtextCursorToggleVisibilityTime: FloatinputRectX: FloatinputRectY: FloatinputRectW: FloatinputRectH: FloatEvent fired when the text content is updated during editing.
| Name | Type | Description |
|---|---|---|
content |
String | The updated text content |
emitStart(): VoidEvent fired when text editing starts.
emitSubmit(): VoidEvent fired when the user submits the text (e.g., pressing Enter in single-line mode).
emitStop(): VoidEvent fired when text editing stops.
bindAsComponent(): VoidhandleStop(): VoidhandleEnter(): VoidhandleEscape(): Void| Name | Type |
|---|---|
text |
String |
| Name | Type |
|---|---|
selectionStart |
Int |
selectionEnd |
Int |
inverted |
Bool |
| Name | Type |
|---|---|
selectionStart |
Int |
selectionEnd |
Int |
bindPointerEvents(): Void| Name | Type |
|---|---|
info |
TouchInfo |
| Name | Type |
|---|---|
delta |
Float |
bindKeyBindings(): VoidcomputeInputRect(): Void| Name | Type |
|---|---|
entity |
Entity |
getEntity(): Entity| Returns |
|---|
| Entity |
Metadata
| Name | Parameters |
|---|---|
:build |
ceramic.macros.ComponentMacro.build() |
:autoBuild |
ceramic.macros.ComponentMacro.build() |
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |