API Reference
FormPreset
A preset a form comes with (Form.Presets): a name and field values. It is listed before the presets people save, marked as built in, and cannot be overwritten or deleted; applying it sets the fields the way a saved preset does.
Inheritance
- Object
- FormPreset
Usage
Explore 5 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 4
- Property Form.Presets
- Method FormPreset.Describe
- Method FormPreset.Value
- Method FormPreset.WithPreview
Accepted by parameters 1
- Method Form.Preset
Constructors
public FormPreset(String name, IDictionary<String, Object?> values) #Creates a built-in preset.
Parameters
- name System.String
- The name; a saved preset cannot take it.
- values System.Collections.Generic.IDictionary<System.String, System.Object?>
- Field values by field name (ignoring case), as the fields take them: a string, a number, a bool, or a list for a multi-choice field.
Methods
public FormPreset Describe(String text) #FormPresetSets the description.
Parameters
- text System.String
- The text.
Returns
The preset.
public override String ToString() #StringReturns a string that represents the current object.
Returns
A string that represents the current object.
public FormPreset Value(String field, Object? value) #FormPresetSets a field's value.
Parameters
- field System.String
- The field name (ignoring case).
- value System.Object?
- The value, as the field takes it: a string, a number, a bool, or a list for a multi-choice field.
Returns
The preset.
public FormPreset WithPreview(IWidget preview) #FormPresetSets the preview (see FormPreset.Preview).
Parameters
- preview ConsoleMonster.Layout.IWidget
- The content.
Returns
The preset.
Inherited Methods
Properties
public String? Description { get; set; } #A sentence about the preset, shown with it, or null.
public IDictionary<String, Object?> Values { get; } #The field values by field name (ignoring case).
public IWidget? Preview { get; set; } #Content describing the preset (what it fills in), for lists that show a preview while a preset has focus; the command palette, where a form's presets are listed today, shows the FormPreset.Description only.