Skip to content
ConsoleMonster

API Reference

Class

FormPreset

Namespace ConsoleMonster.Interactive
Assembly ConsoleMonster
Modifiers sealed

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

Accepted by parameters 1

Constructors

public FormPreset(String name, IDictionary<String, Object?> values) #

Creates a built-in preset.

Parameters

name System.String requiredposition: 0
The name; a saved preset cannot take it.
values System.Collections.Generic.IDictionary<System.String, System.Object?> requiredposition: 1
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) #
Returns: FormPreset

Sets the description.

Parameters

text System.String requiredposition: 0
The text.

Returns

The preset.

public override String ToString() #
Returns: String

Returns a string that represents the current object.

Returns

A string that represents the current object.

public FormPreset Value(String field, Object? value) #
Returns: FormPreset

Sets a field's value.

Parameters

field System.String requiredposition: 0
The field name (ignoring case).
value System.Object? requiredposition: 1
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) #
Returns: FormPreset

Sets the preview (see FormPreset.Preview).

Parameters

preview ConsoleMonster.Layout.IWidget requiredposition: 0
The content.

Returns

The preset.

Properties

public String Name { get; } #

The name.

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.