Table of Contents

Class InlineButtonWidget

Namespace
ItTiger.TigerCli.Tui.Widgets
Assembly
ItTiger.TigerCli.dll
A reusable button widget. It carries a label, the DialogResultKind it produces when activated, and an enabled state; it renders itself for the focused/unfocused/disabled states. A single button is primarily a value/rendering widget — navigation and activation across a row of buttons live in InlineButtonGroupWidget.
public sealed class InlineButtonWidget : InlineWidget, ICliRenderable
Inheritance
InlineButtonWidget
Implements
Inherited Members

Remarks

The selected button renders textual markers ([▸ Yes ◂]) so the selection is visible without relying on colour; an unselected button keeps the same width ([ No ]). Selection and group focus are independent: a selected button keeps its markers whether or not its group has focus — group focus only changes the selected button's background (active vs muted).

Constructors

InlineButtonWidget(ICliAppShell, string, DialogResultKind, bool)

Creates a button that requests a dialog result when activated.
public InlineButtonWidget(ICliAppShell shell, string label, DialogResultKind result, bool enabled = true)

Parameters

shell ICliAppShell
The shell that supplies the theme.
label string
The text displayed on the button.
result DialogResultKind
The dialog result requested when the button is activated.
enabled bool
Whether the button can be activated.

Properties

Enabled

Whether the button can be activated.
public bool Enabled { get; set; }

Property Value

bool

Focusable

Whether the widget can receive focus. Non-focusable widgets are skipped by focus traversal.
public override bool Focusable { get; }

Property Value

bool

GroupFocused

Whether the owning button group currently has focus. Set by InlineButtonGroupWidget. It only affects the selected button's background (active vs inactive); it never hides the selection markers. HasFocus carries the independent "is the selected button" concept that drives the markers.
public bool GroupFocused { get; set; }

Property Value

bool

Label

The text displayed on the button.
public string Label { get; }

Property Value

string

Result

The dialog result requested when the button is activated.
public DialogResultKind Result { get; }

Property Value

DialogResultKind

Methods

Activate()

Activates the button. An enabled button requests its Result; a disabled button is still considered handled but produces no result, so the host does not fall back to Enter.
public InlineKeyResult Activate()

Returns

InlineKeyResult

HandleKey(KeyEvent)

Handles a key. Returns whether it was consumed and any requested dialog result.
public override InlineKeyResult HandleKey(KeyEvent key)

Parameters

key KeyEvent

Returns

InlineKeyResult

ToGrid()

Converts the component into a grid for measurement and rendering.
public override CliGrid ToGrid()

Returns

CliGrid