Skip to main content

SliderModal class

Namespace: Arlecchino.Modals.Setting · Assembly: Arlecchino

A value inside a range, adjusted by arrows or by dragging the track. There is nothing to type, so the value is always valid, and the dialog never reports an error.

public sealed class SliderModal : NumericModal, IAffixedModal, IBoundedModal

Inherits from NumericModal
Implements IAffixedModal, IBoundedModal

Constructors

MemberSummary
SliderModal()

Properties

MemberSummary
FractionHow far along the track the handle sits, as 0 to 1. An empty range reads as 0.
MaximumValue at the right end of the track.
MinimumValue at the left end of the track.
OnSubmitCalled with the value the handle was left at.
TrackWhere the track was drawn last frame, used to turn a click into a value.
ValueWhere the handle sits.

Methods

MemberSummary
Add(decimal)Moves the handle, stopping at the ends of the range.
Draw(ModalFrame)
Handle(ModalFrame, KeyPress)
HandleMouse(ModalFrame, MouseEvent)
MoveToMaximum()Jumps to the right end.
MoveToMinimum()Jumps to the left end.
SetFromFraction(decimal)Places the handle at a position along the track.

Constructors in detail

SliderModal()

Obsolete

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

public SliderModal();

Properties in detail

Fraction

public decimal Fraction { get; }

How far along the track the handle sits, as 0 to 1. An empty range reads as 0.

Type decimal

Maximum

public decimal Maximum { get; init; }

Value at the right end of the track.

Type decimal

Minimum

public decimal Minimum { get; init; }

Value at the left end of the track.

Type decimal

OnSubmit

public Action<decimal> OnSubmit { get; init; }

Called with the value the handle was left at.

Type Action<T><decimal>

Track

public SurfaceRegion Track { get; set; }

Where the track was drawn last frame, used to turn a click into a value.

Type SurfaceRegion

Value

public decimal Value { get; set; }

Where the handle sits.

Type decimal

Methods in detail

Add(decimal)

public void Add(decimal delta);

Moves the handle, stopping at the ends of the range.

Parameters

NameTypeDescription
deltadecimalHow far to move; negative goes left.

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

HandleMouse(ModalFrame, MouseEvent)

public override void HandleMouse(ModalFrame frame, MouseEvent mouse);

Parameters

NameTypeDescription
frameModalFrame
mouseMouseEvent

MoveToMaximum()

public void MoveToMaximum();

Jumps to the right end.

MoveToMinimum()

public void MoveToMinimum();

Jumps to the left end.

SetFromFraction(decimal)

public void SetFromFraction(decimal fraction);

Places the handle at a position along the track.

Parameters

NameTypeDescription
fractiondecimalPosition from 0 at the left end to 1 at the right; anything outside is pulled in.