BaseTextFieldView

Base class for text field UI elements with autocomplete functionality.

Provides a foundation for text input fields with features like:

  • Text editing with EditText integration
  • Autocomplete suggestions with fuzzy search
  • Keyboard navigation for suggestions
  • Customizable value submission and validation
  • Integration with the field system for UI forms

This is an abstract base class meant to be extended by concrete implementations like TextFieldView, ColorFieldView, etc.

Instance Members

elements
textValue: String

The current text value displayed in the field


elements
autocompleteCandidates: Array<String>

Array of autocomplete suggestion candidates. When set, enables autocomplete functionality with fuzzy search.


elements
autocompleteDelay: Float

Delay in seconds before showing autocomplete suggestions after typing


elements
autocompleteMaxResults: Int

Maximum number of autocomplete suggestions to display


elements
autocompleteOnFocus: Bool

Whether to show autocomplete suggestions when the field gains focus


elements
clipSuggestions: Bool

Whether to clip suggestions dropdown to scrolling container bounds


elements
setTextValue(field: BaseTextFieldView, textValue: String): Void

Hook called when the text value changes. Updates the internal text value and calls setValue.

Name Type Description
field BaseTextFieldView The field instance (this)
textValue String The new text value

elements
setValue(field: BaseTextFieldView, value: Dynamic): Void

Hook for setting the underlying value from text. Override this to convert text to the appropriate data type.

Name Type Description
field BaseTextFieldView The field instance (this)
value Dynamic The value to set (typically string)

elements
setEmptyValue(field: BaseTextFieldView): Void

Hook for clearing/resetting the field value. Override this to handle empty field state.

Name Type Description
field BaseTextFieldView The field instance (this)

elements
submit(field: BaseTextFieldView): Void

Hook called when the user submits the field (e.g., pressing Enter). Override this to handle form submission or value confirmation.

Name Type Description
field BaseTextFieldView The field instance (this)

elements
invalidateTextValue(): Void

elements
destroy(): Void

elements
hitsSelfOrDerived(x: Float, y: Float): Bool
Name Type
x Float
y Float
Returns
Bool

elements
usesScanCode(scanCode: ceramic.ScanCode): Bool
Name Type
scanCode ceramic.ScanCode
Returns
Bool

elements
usesKeyCode(keyCode: ceramic.KeyCode): Bool
Name Type
keyCode ceramic.KeyCode
Returns
Bool

Private Members

elements
MAX_LIST_HEIGHT: Int

Maximum height of the autocomplete suggestions dropdown in pixels


elements
FORCED_SUGGESTION_FULL_LIST_UNDER_COUNT: Int

When forcing suggestions display, show all candidates if fewer than this count


elements
ITEM_HEIGHT: Int

Height of each suggestion item in the dropdown


elements
unobservedTextValue: String

elements
editingThisFrame: Bool

Flag tracking if text is being edited in the current frame


elements
suggestionsVisibleThisFrame: Bool

Flag tracking if suggestions are visible in the current frame


elements
keyBindings: ceramic.KeyBindings

Key bindings for text selection and autocomplete shortcuts


elements
textView: ceramic.TextView

The TextView component for displaying text


elements
editText: ceramic.EditText

The EditText component for text input when focused


elements
processedAutocompleteCandidates: Array<AnonStruct>

Processed candidates with normalized search strings


elements
suggestionsView: SelectListView

The dropdown list view for showing suggestions


elements
suggestionsContainer: ceramic.View

Container view for positioning the suggestions dropdown


elements
suggestions: Array<String>

Current filtered list of suggestions to display


elements
transformTextForCompletion(text: String): String

Transforms text for autocomplete matching. Replaces spaces with underscores for better fuzzy matching.

Name Type Description
text String The text to transform
Returns Description
String The transformed text

elements
emitTextValueChange(current: String, previous: String): Void

Event when textValue field changes.

Name Type
current String
previous String

elements
didLostFocus(): Void

elements
handleAutocompleteOnFocus(focused: Bool, prevFocused: Bool): Void
Name Type
focused Bool
prevFocused Bool

elements
cancelAutoComplete(): Void

Timer cancellation function for autocomplete delay


elements
handleEditTextSubmit(): Void

elements
updateFromEditText(text: String): Void
Name Type
text String

elements
updateFromTextValue(): Void

elements
updateAutocompleteSuggestions(?force: Bool = false): Void

Updates the autocomplete suggestions based on current text. Uses fuzzy search to filter candidates.

Name Type Default Description
force Bool false Whether to force showing suggestions even with empty/full matches

elements
suggestionsKeyDown(key: ceramic.Key): Void
Name Type
key ceramic.Key

elements
suggestionsValueChange(value: String, prevValue: String): Void
Name Type
value String
prevValue String

elements
suggestionsValueClick(value: String): Void
Name Type
value String

elements
suggestionDeepScore(item: String, query: String): Float
Name Type
item String
query String
Returns
Float

elements
layoutSuggestionsContainer(): Void

elements
suggestionsHeight(): Float
Returns
Float

elements
updateSuggestionsPosition(): Void

elements
updateThisFrameFlags(): Void

elements
updateSuggestionsVisibility(): Void

elements
clearSuggestions(): Void

elements
bindKeyBindings(): Void

Sets up keyboard shortcuts for the text field.

  • Cmd/Ctrl+A: Select all text
  • Cmd/Ctrl+Space: Force show autocomplete suggestions

elements
new(): Void

Creates a new BaseTextFieldView. Sets up update handlers and autocomplete functionality.

Metadata

Name Parameters
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:build tracker.macros.ObservableMacro.build()
:autoBuild tracker.macros.ObservableMacro.build()