Skip to main content

MultiChoiceModal class

Namespace: Arlecchino.Modals.Choosing · Assembly: Arlecchino

Any number of options out of a filterable list. Marks survive a change of filter.

public sealed class MultiChoiceModal : OptionListModal, ITextEntry

Inherits from OptionListModal
Implements ITextEntry

Constructors

MemberSummary
MultiChoiceModal()

Properties

MemberSummary
OnSubmitCalled with everything marked, in the order of the options.
SelectedKeysOptions marked so far.

Methods

MemberSummary
Draw(ModalFrame)
Handle(ModalFrame, KeyPress)
IsSelected(string)Whether an option is marked.
SelectedInOptionOrder()What is marked, in the order of the options rather than the order it was clicked in, so the result does not depend on how the user got there.
Take(ModalFrame, string)
Toggle(string)Marks an option, or unmarks it when it already was.

Constructors in detail

MultiChoiceModal()

Obsolete

Constructors of types with required members are not supported in this version of your compiler.

public MultiChoiceModal();

Properties in detail

OnSubmit

public Action<IReadOnlyList<string>> OnSubmit { get; init; }

Called with everything marked, in the order of the options.

Type Action<T><IReadOnlyList<T><string>>

SelectedKeys

public HashSet<string> SelectedKeys { get; init; }

Options marked so far.

Type HashSet<T><string>

Methods in detail

Draw(ModalFrame)

public override void Draw(ModalFrame frame);

Parameters

NameTypeDescription
frameModalFrame

Handle(ModalFrame, KeyPress)

public override void Handle(ModalFrame frame, KeyPress key);

Parameters

NameTypeDescription
frameModalFrame
keyKeyPress

IsSelected(string)

public bool IsSelected(string choice);

Whether an option is marked.

Parameters

NameTypeDescription
choicestringThe option to check.

Returns booltrue when it is marked.

SelectedInOptionOrder()

public List<string> SelectedInOptionOrder();

What is marked, in the order of the options rather than the order it was clicked in, so the result does not depend on how the user got there.

Returns List<T><string> — The marked options.

Take(ModalFrame, string)

public virtual void Take(ModalFrame frame, string choice);

Parameters

NameTypeDescription
frameModalFrame
choicestring

Toggle(string)

public void Toggle(string choice);

Marks an option, or unmarks it when it already was.

Parameters

NameTypeDescription
choicestringThe option to flip.