Table of Contents

Method ErrorQuery

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

ErrorQuery(IApplication?, int, int, string, string, params string[])

Displays an error MessageBox with fixed dimensions.

public static int? ErrorQuery(IApplication? app, int width, int height, string title, string message, params string[] buttons)

Parameters

app IApplication

The application instance. If null, uses TopRunnableView.

width int

Width for the MessageBox.

height int

Height for the MessageBox.

title string

Title for the MessageBox.

message string

Message to display. May contain multiple lines and will be word-wrapped.

buttons string[]

Array of button labels.

Returns

int?

The index of the selected button, or null if the user pressed QuitKey.

Remarks

Consider using ErrorQuery(IApplication?, string, string, params string[]) which automatically sizes the MessageBox.

Exceptions

ArgumentNullException

Thrown if app is null.

ErrorQuery(IApplication?, string, string, params string[])

Displays an auto-sized error MessageBox.

public static int? ErrorQuery(IApplication? app, string title, string message, params string[] buttons)

Parameters

app IApplication

The application instance. If null, uses TopRunnableView.

title string

Title for the MessageBox.

message string

Message to display. May contain multiple lines and will be word-wrapped.

buttons string[]

Array of button labels.

Returns

int?

The index of the selected button, or null if the user pressed QuitKey.

Remarks

The MessageBox is centered and auto-sized based on title, message, and buttons.

Exceptions

ArgumentNullException

Thrown if app is null.

ErrorQuery(IApplication?, int, int, string, string, int, params string[])

Displays an error MessageBox with fixed dimensions and a default button.

public static int? ErrorQuery(IApplication? app, int width, int height, string title, string message, int defaultButton = 0, params string[] buttons)

Parameters

app IApplication

The application instance. If null, uses TopRunnableView.

width int

Width for the MessageBox.

height int

Height for the MessageBox.

title string

Title for the MessageBox.

message string

Message to display. May contain multiple lines and will be word-wrapped.

defaultButton int

Index of the default button (0-based).

buttons string[]

Array of button labels.

Returns

int?

The index of the selected button, or null if the user pressed QuitKey.

Remarks

Consider using ErrorQuery(IApplication?, string, string, int, params string[]) which automatically sizes the MessageBox.

Exceptions

ArgumentNullException

Thrown if app is null.

ErrorQuery(IApplication?, string, string, int, params string[])

Displays an auto-sized error MessageBox with a default button.

public static int? ErrorQuery(IApplication? app, string title, string message, int defaultButton = 0, params string[] buttons)

Parameters

app IApplication

The application instance. If null, uses TopRunnableView.

title string

Title for the MessageBox.

message string

Message to display. May contain multiple lines and will be word-wrapped.

defaultButton int

Index of the default button (0-based).

buttons string[]

Array of button labels.

Returns

int?

The index of the selected button, or null if the user pressed QuitKey.

Remarks

The MessageBox is centered and auto-sized based on title, message, and buttons.

Exceptions

ArgumentNullException

Thrown if app is null.

ErrorQuery(IApplication?, int, int, string, string, int, bool, params string[])

Displays an error MessageBox with fixed dimensions, a default button, and word-wrap control.

public static int? ErrorQuery(IApplication? app, int width, int height, string title, string message, int defaultButton = 0, bool wrapMessage = true, params string[] buttons)

Parameters

app IApplication

The application instance. If null, uses TopRunnableView.

width int

Width for the MessageBox.

height int

Height for the MessageBox.

title string

Title for the MessageBox.

message string

Message to display. May contain multiple lines.

defaultButton int

Index of the default button (0-based).

wrapMessage bool

If true, word-wraps the message; otherwise displays as-is with multi-line support.

buttons string[]

Array of button labels.

Returns

int?

The index of the selected button, or null if the user pressed QuitKey.

Remarks

Consider using ErrorQuery(IApplication?, string, string, int, bool, params string[]) which automatically sizes the MessageBox.

Exceptions

ArgumentNullException

Thrown if app is null.

ErrorQuery(IApplication?, string, string, int, bool, params string[])

Displays an auto-sized error MessageBox with a default button and word-wrap control.

public static int? ErrorQuery(IApplication? app, string title, string message, int defaultButton = 0, bool wrapMessage = true, params string[] buttons)

Parameters

app IApplication

The application instance. If null, uses TopRunnableView.

title string

Title for the MessageBox.

message string

Message to display. May contain multiple lines.

defaultButton int

Index of the default button (0-based).

wrapMessage bool

If true, word-wraps the message; otherwise displays as-is with multi-line support.

buttons string[]

Array of button labels.

Returns

int?

The index of the selected button, or null if the user pressed QuitKey.

Remarks

The MessageBox is centered and auto-sized based on title, message, and buttons.

Exceptions

ArgumentNullException

Thrown if app is null.