Table of Contents

Class ConfirmDialog

Namespace
MiniTui
Assembly
MiniTui.dll

A yes/no question, used by ConfirmAsync(string, string, string). ← → Tab h l switch buttons; Enter picks the selected one; y answers yes; n and Esc answer no.

public sealed class ConfirmDialog : Overlay
Inheritance
ConfirmDialog
Inherited Members

Constructors

ConfirmDialog(string, string, string)

Create a dialog. Show it with Show(Overlay) and await Result.

public ConfirmDialog(string message, string yes = "Yes", string no = "No")

Parameters

message string
yes string
no string

Properties

Result

The answer: true for yes; false for no, or when the dialog is closed any other way.

public Task<bool> Result { get; }

Property Value

Task<bool>

Title

The title in the overlay's border.

public override string? Title { get; }

Property Value

string

Methods

HandleKey(ConsoleKeyInfo)

Handle a key before Keys. Return true if handled.

public override bool HandleKey(ConsoleKeyInfo key)

Parameters

key ConsoleKeyInfo

Returns

bool

HandleMouse(MouseEvent)

Handle a mouse event inside this component's Area (1.x spec §4.7). Return true if handled; otherwise the event goes on to the component's parent, and is dropped if nothing handles it. A press has already focused the component when this runs.

public override bool HandleMouse(MouseEvent mouse)

Parameters

mouse MouseEvent

Returns

bool

OnMount()

Called when the component is mounted, before its children.

protected override void OnMount()

OnUnmount()

Called when the component unmounts, after its children and after Lifetime is cancelled.

protected override void OnUnmount()

Placement(Rect)

Where the overlay goes, including its border. The default is centered, 60% × 50% of the screen, at least 30 × 7, and clamped to the screen minus a 2-cell margin.

public override Rect Placement(Rect screen)

Parameters

screen Rect

Returns

Rect

Render(Buffer, Rect, RenderContext)

Draw the component. Called every frame its parent renders it.

public override void Render(Buffer buf, Rect area, RenderContext ctx)

Parameters

buf Buffer
area Rect
ctx RenderContext