Table of Contents

Class TuiSelectable

Namespace
AshConsoleGraphics.Interactive
Assembly
AshConsoleGraphics.dll

An interactive element that can be selected and does things

public abstract class TuiSelectable : TuiElement
Inheritance
TuiSelectable
Derived
Inherited Members

Constructors

TuiSelectable(Placement, int, int)

Initializes a new selectable element

protected TuiSelectable(Placement p, int x, int y)

Parameters

p Placement

The relative placement method

x int

The relative x offset

y int

The relative x offset

Fields

LeftSelector

Global left selector char for all included Selectables

public static char? LeftSelector

Field Value

char?

RightSelector

Global right selector char for all included Selectables

public static char? RightSelector

Field Value

char?

Properties

KeyFunctions

Keybinds and their actions

public Dictionary<(ConsoleKey, ConsoleModifiers), Action<TuiSelectable, ConsoleKeyInfo>> KeyFunctions { get; }

Property Value

Dictionary<(ConsoleKey, ConsoleModifiers), Action<TuiSelectable, ConsoleKeyInfo>>

Selected

If it is selected or not

public bool Selected { get; }

Property Value

bool

Methods

DeleteAllKeyEvents()

Deletes all key events

public TuiSelectable DeleteAllKeyEvents()

Returns

TuiSelectable

HandleKey(ConsoleKeyInfo)

Handles a key press

public virtual bool HandleKey(ConsoleKeyInfo keyInfo)

Parameters

keyInfo ConsoleKeyInfo

Returns

bool

SubKeyEvent(ConsoleKey, Action<TuiSelectable, ConsoleKeyInfo>)

Subscribes a new key event with no modifiers

public TuiSelectable SubKeyEvent(ConsoleKey k, Action<TuiSelectable, ConsoleKeyInfo> keyFunction)

Parameters

k ConsoleKey

The key pressed

keyFunction Action<TuiSelectable, ConsoleKeyInfo>

The action to call

Returns

TuiSelectable

SubKeyEvent(ConsoleKey, ConsoleModifiers, Action<TuiSelectable, ConsoleKeyInfo>)

Subscribes a new key event

public TuiSelectable SubKeyEvent(ConsoleKey k, ConsoleModifiers m, Action<TuiSelectable, ConsoleKeyInfo> keyFunction)

Parameters

k ConsoleKey

The key pressed

m ConsoleModifiers

The key modifiers (cntrl, shift)

keyFunction Action<TuiSelectable, ConsoleKeyInfo>

The action to call

Returns

TuiSelectable

Events

OnSelection

public event EventHandler OnSelection

Event Type

EventHandler