struct
TUI::Form::FieldSpec(M)
- TUI::Form::FieldSpec(M)
- Struct
- Value
- Object
Overview
Declares one field of a Form::Host(M) form: its label, how to build
the FormField that edits it, and how to read/write its value on the
bound model M. #get/#set are required (no default) so a
FieldSpec can never be constructed without a real binding to the
model — this is the mechanism, not a convention, that rules out a
field silently defaulting to a hardcoded value disconnected from
whatever model it's supposedly editing.
#dropdown_options/#dropdown_multi opt a field out of the normal
#build-a-FormField flow entirely — FormField's abstract contract
has no side-channel for "please push a popup," so a field with
#dropdown_options set is instead driven by Form::Host directly via
TUI::DropdownPicker (see Form::Host#open_dropdown). #build is
nilable and unused for dropdown fields.
Defined in:
tui/form/field_spec.crConstructors
Instance Method Summary
- #build : -> FormField | Nil
- #clone
- #copy_with(label _label = @label, get _get = @get, set _set = @set, build _build = @build, rows _rows = @rows, validator _validator = @validator, error_message _error_message = @error_message, dropdown_options _dropdown_options = @dropdown_options, dropdown_multi _dropdown_multi = @dropdown_multi)
- #dropdown_multi : Bool
- #dropdown_options : Array(FormEnumOption) | Nil
- #error_message : String
- #get : M -> String
- #label : String
- #rows : Int32
- #set : M, String -> Nil
- #validator : String -> Bool | Nil