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
Properties
KeyFunctions
Keybinds and their actions
public Dictionary<(ConsoleKey, ConsoleModifiers), Action<TuiSelectable, ConsoleKeyInfo>> KeyFunctions { get; }
Property Value
Selected
If it is selected or not
public bool Selected { get; }
Property Value
Methods
DeleteAllKeyEvents()
Deletes all key events
public TuiSelectable DeleteAllKeyEvents()
Returns
HandleKey(ConsoleKeyInfo)
Handles a key press
public virtual bool HandleKey(ConsoleKeyInfo keyInfo)
Parameters
keyInfo
ConsoleKeyInfo
Returns
SubKeyEvent(ConsoleKey, Action<TuiSelectable, ConsoleKeyInfo>)
Subscribes a new key event with no modifiers
public TuiSelectable SubKeyEvent(ConsoleKey k, Action<TuiSelectable, ConsoleKeyInfo> keyFunction)
Parameters
k
ConsoleKeyThe key pressed
keyFunction
Action<TuiSelectable, ConsoleKeyInfo>The action to call
Returns
SubKeyEvent(ConsoleKey, ConsoleModifiers, Action<TuiSelectable, ConsoleKeyInfo>)
Subscribes a new key event
public TuiSelectable SubKeyEvent(ConsoleKey k, ConsoleModifiers m, Action<TuiSelectable, ConsoleKeyInfo> keyFunction)
Parameters
k
ConsoleKeyThe key pressed
m
ConsoleModifiersThe key modifiers (cntrl, shift)
keyFunction
Action<TuiSelectable, ConsoleKeyInfo>The action to call
Returns
Events
OnSelection
public event EventHandler OnSelection