SelectFieldView

ceramic.Entityceramic.Visualceramic.Quadceramic.Layerceramic.Viewceramic.LinearLayoutFieldViewelements.SelectFieldView (Class)

A dropdown selection field that allows users to choose from a predefined list of options.

SelectFieldView provides a text-based dropdown interface with keyboard navigation support. It displays the currently selected value and shows a dropdown list when activated. The field supports null values, keyboard shortcuts, and intelligent positioning of the dropdown list.

Key features:

  • Dropdown list with hover and click selection
  • Keyboard navigation (Arrow keys, Enter, Space, Escape)
  • Support for null values with custom text
  • Auto-positioning above/below based on available space
  • Focus management and escape handling
  • Clipping support for scrollable containers

Usage example:

var selectField = new SelectFieldView();
selectField.list = ['Option 1', 'Option 2', 'Option 3'];
selectField.nullValueText = 'Choose an option...';
selectField.value = 'Option 1';
selectField.onValueChange(this, (value, prev) -> {
    trace('Selected: ' + value);
});
add(selectField);

Instance Members

elements
theme: Theme

Custom theme override for this select field. If null, uses the global context theme


elements
value: String

The currently selected value. Can be null if no value is selected


Array of available options to choose from


elements
nullValueText: String

Text to display when value is null. If null, empty text is shown


elements
inputStyle: Anonymous

Visual style of the field (DEFAULT, OVERLAY, or MINIMAL)


elements
clipList: Bool

Whether to clip the dropdown list to scrollable container bounds


elements
invalidateTheme(): Void

elements
setValue(field: SelectFieldView, value: String): Void

Hook called when the field value changes.

Override this function to implement custom behavior when the value is set. The default implementation does nothing.

Name Type Description
field SelectFieldView The select field instance
value String The new value being set

elements
invalidateValue(): Void

elements
invalidateList(): Void

elements
invalidateNullValueText(): Void

elements
invalidateInputStyle(): Void

elements
invalidateListVisible(): Void

elements
focus(): Void

Handles focus events for the field.

Currently delegates to parent focus behavior. Text editing is disabled for select fields in favor of dropdown selection.


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

elements
new(): Void

Creates a new SelectFieldView.

Sets up the field container, text display, dropdown positioning, keyboard navigation, and all necessary event handlers.

Private Members

elements
MAX_LIST_HEIGHT: Int

Maximum height of the dropdown list in pixels


elements
ITEM_HEIGHT: Int

Height of each item in the dropdown list


elements
unobservedTheme: Theme

elements
unobservedValue: String

elements
unobservedList: ceramic.ReadOnlyArray<String>

elements
unobservedNullValueText: String

elements
unobservedInputStyle: Anonymous

elements
listVisible: Bool

Whether the dropdown list is currently visible


elements
unobservedListVisible: Bool

elements
container: ceramic.RowLayout

Container for the field display elements


elements
textView: ceramic.TextView

Text view displaying the current selection


elements
listView: SelectListView

The dropdown list view component


elements
listContainer: ceramic.View

Container for positioning the dropdown list


elements
tip: ceramic.Line

Arrow/triangle indicator showing dropdown availability


elements
listIsAbove: Bool

Whether the dropdown list is positioned above the field


elements
listVisibleThisFrame: Bool

Tracks if list was visible in the current frame for input handling


elements
emitThemeChange(current: Theme, previous: Theme): Void

Event when theme field changes.

Name Type
current Theme
previous Theme

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

Event when value field changes.

Name Type
current String
previous String

elements
emitListChange(current: ceramic.ReadOnlyArray<String>, previous: ceramic.ReadOnlyArray<String>): Void

Event when list field changes.

Name Type
current ceramic.ReadOnlyArray<String>
previous ceramic.ReadOnlyArray<String>

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

Event when nullValueText field changes.

Name Type
current String
previous String

elements
emitInputStyleChange(current: Anonymous, previous: Anonymous): Void

Event when inputStyle field changes.

Name Type
current Anonymous
previous Anonymous

elements
emitListVisibleChange(current: Bool, previous: Bool): Void

Event when listVisible field changes.

Name Type
current Bool
previous Bool

elements
didLostFocus(): Void

elements
layout(): Void

elements
layoutContainer(): Void

Layouts the field container and clips text to fit available space.

Ensures the displayed text doesn't overflow into the dropdown arrow area by clipping it to the available width minus arrow space.


elements
layoutListContainer(): Void

Layouts the dropdown list container.

Sizes the list view to match the field width and calculated height based on the number of available options.


elements
listHeight(): Float

Calculates the optimal height for the dropdown list.

Returns Description
Float Height in pixels, limited by MAX_LIST_HEIGHT

elements
updateFromValue(): Void

Updates the displayed text based on the current value.

Shows the selected value or the null value text if no value is selected. Sanitizes the display text by trimming whitespace and replacing newlines.


elements
updateStyle(): Void

elements
updateListVisibility(): Void

elements
updateListPosition(): Void

elements
updateListVisibleThisFrame(): Void

elements
toggleListVisible(): Void

Toggles the visibility of the dropdown list.


elements
updateListContainer(): Void

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()