TUI::Form::Host(M)
Inherits TUI::Widget < Reference < Object
Drives a list of FieldSpec(M) against a bound model M. Layout and
per-field focus/editing are delegated to an internal Grid
(src/tui/layout/grid.cr) of FormFieldCell widgets (one per field,
each drawing its own label + editor and handling its own
start/commit/cancel) — Host itself now only owns the outer
box/title chrome and builds the Grid once at construction time.
Previously Host hand-computed row/column coordinates and drove
@editor/@focus_index directly; that per-field state now lives in
each FormFieldCell, and cross-field focus traversal (Tab/Shift+Tab)
lives in Grid — both reusable independent of Form::Host.
Constants
Default column width reserved for a field's label, before the value
column starts — override via #initialize's label_width for
consumers with longer labels.
Default upper bound on how much value-column width an inline error
message may claim, even if there'd be room to give it more.
Override via #initialize's max_error_width.
Default floor: the value column must keep at least this much width
before any of it is given up to an inline error message — below
this floor, the error is dropped rather than squeezing the value
further. Override via #initialize's min_value_width.
Constructors
Class methods
Sizes and positions a Host to fill the screen below the status bar row — see Window.full_screen for the same reasoning.
Instance methods
Re-derives the Grid's own x/y/width/height from Host's current geometry every frame — the same convention HSplit#composite/ #layout follow, rather than trusting the values fixed at construction — so a Host that gets resized after construction (e.g. Runtime's SIGWINCH handler calling Widget#width=/#height= on whatever full-screen page is on top of the NavStack, which includes a Form::Host page like example/pages/form_page.cr) still hosts a correctly-sized Grid, which in turn reflows every attached FormFieldCell's width via its own weighted #col_widths (see Grid#layout) instead of staying pinned to the width current when the Grid/cells were first constructed.
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.