Class InlineButtonGroupWidget
A reusable horizontal row of buttons — the main reusable unit for message-box style button rows
(
[OK], [Yes] [No], [OK] [Cancel], [Abort] [Retry] [Ignore]).public sealed class InlineButtonGroupWidget : InlineWidget, ICliRenderable
- Inheritance
-
InlineButtonGroupWidget
- Implements
- Inherited Members
Remarks
Left/Right (and Home/End) move the active button across all buttons, including disabled ones, so a
disabled button can be the active one. Enter/Spacebar activate the active button: an enabled
button returns its DialogResultKind; a disabled button is consumed without a result
(so the dialog does not fall back to Enter-confirm). Escape is intentionally left unhandled so the
dialog's cancel fallback can fire.
Constructors
InlineButtonGroupWidget(ICliAppShell, IReadOnlyList<InlineButtonWidget>, int?)
Creates a horizontal group of buttons with one active button.
public InlineButtonGroupWidget(ICliAppShell shell, IReadOnlyList<InlineButtonWidget> buttons, int? activeIndex = null)
Parameters
shellICliAppShell- The shell that supplies the theme and culture.
buttonsIReadOnlyList<InlineButtonWidget>- The buttons to display, from left to right.
activeIndexint?- The initially active button index, or
nullfor the first button.
Properties
ActiveButton
The active button, or
null when the group is empty.public InlineButtonWidget? ActiveButton { get; }
Property Value
ActiveIndex
The active button index, or
-1 when the group is empty.public int ActiveIndex { get; }
Property Value
Buttons
The buttons displayed by the group, from left to right.
public IReadOnlyList<InlineButtonWidget> Buttons { get; }
Property Value
Focusable
Whether the widget can receive focus. Non-focusable widgets are skipped by focus traversal.
public override bool Focusable { get; }
Property Value
Hint
Optional focus-aware hint a composite control may surface to the dialog.
public override string? Hint { get; }
Property Value
Methods
HandleKey(KeyEvent)
Handles a key. Returns whether it was consumed and any requested dialog result.
public override InlineKeyResult HandleKey(KeyEvent key)
Parameters
keyKeyEvent
Returns
ToGrid()
Converts the component into a grid for measurement and rendering.
public override CliGrid ToGrid()