class
TUI::Form::FormFieldCell(M)
- TUI::Form::FormFieldCell(M)
- TUI::Widget
- Reference
- Object
Overview
One form row as its own composited Widget: a label plus whichever
FormField edit session field.build constructs (or, for a
dropdown_options field, a TUI::DropdownPicker popup pushed
through popup instead — see #start_editing). Grid
(src/tui/layout/grid.cr) positions and focuses one of these per
field; Form::Host builds one FormFieldCell per FieldSpec and
attaches them into its internal Grid, rather than looping over
@fields and hand-computing row/column coordinates itself the way
it used to.
field.get/field.set are the only way this class reads or
writes @model — a FieldSpec cannot exist without both, so every
cell rendered or committed here is guaranteed to be backed by a
real accessor on M, never a value invented independently of the
model. This mirrors the invariant Form::Host itself used to state.
Defined in:
tui/form/form_field_cell.crConstant Summary
-
DEFAULT_MAX_ERROR_WIDTH =
40 -
DEFAULT_MIN_VALUE_WIDTH =
20
Constructors
Instance Method Summary
- #error_style : Style
- #error_style=(error_style : Style)
-
#handle_key(ev : KeyEvent) : Bool
Returns true if the key was consumed.
- #label_error_style : Style
- #label_error_style=(label_error_style : Style)
- #label_style : Style
- #label_style=(label_style : Style)
-
#popup_border_style : Style
Applied to a dropdown popup's own border when this cell opens one (see #open_dropdown) — passed in from Form::Host's own border_style so a dropdown popup visually matches the form it was opened from, the same styling Form::Host applied directly before this logic moved into FormFieldCell.
-
#popup_border_style=(popup_border_style : Style)
Applied to a dropdown popup's own border when this cell opens one (see #open_dropdown) — passed in from Form::Host's own border_style so a dropdown popup visually matches the form it was opened from, the same styling Form::Host applied directly before this logic moved into FormFieldCell.
-
#render : Nil
Draw into @buffer using LOCAL coordinates (0, 0 = this widget's own top-left).
-
#status_hint : String
Plain text describing the actions available in the widget's current state.
Instance methods inherited from class TUI::Widget
absolute(row : Int32, col : Int32) : NamedTuple(row: Int32, col: Int32)
absolute,
composite(screen : Screen) : Nil
composite,
focus_if(condition : Bool) : Nil
focus_if,
focused=(focused : Bool)
focused=,
focused? : Bool
focused?,
handle_key(ev : KeyEvent) : Bool
handle_key,
height : Int32
height,
height=(height : Int32)
height=,
local(row : Int32, col : Int32) : NamedTuple(row: Int32, col: Int32)
local,
render : Nil
render,
render_to(buffer : Buffer) : Nil
render_to,
status_hint : String
status_hint,
width : Int32
width,
width=(width : Int32)
width=,
x : Int32
x,
x=(x : Int32)
x=,
y : Int32
y,
y=(y : Int32)
y=
Constructor methods inherited from class TUI::Widget
new(x : Int32, y : Int32, width : Int32, height : Int32)
new
Constructor Detail
Instance Method Detail
Returns true if the key was consumed.
Applied to a dropdown popup's own border when this cell opens one (see #open_dropdown) — passed in from Form::Host's own border_style so a dropdown popup visually matches the form it was opened from, the same styling Form::Host applied directly before this logic moved into FormFieldCell.
Applied to a dropdown popup's own border when this cell opens one (see #open_dropdown) — passed in from Form::Host's own border_style so a dropdown popup visually matches the form it was opened from, the same styling Form::Host applied directly before this logic moved into FormFieldCell.
Draw into @buffer using LOCAL coordinates (0, 0 = this widget's own
top-left). Widgets never need to know their own x/y offset to draw
themselves — that arithmetic is handled entirely by composite.
Plain text describing the actions available in the widget's current state. Rendered by the App in the global status bar at the bottom of the screen — widgets must NOT draw their own hint lines.