Class MessageBox
MessageBox displays a modal message to the user, with a title, a message and a series of options that the user can choose from.
Inheritance
System.Object
MessageBox
Examples
var n = MessageBox.Query ("Quit Demo", "Are you sure you want to quit this demo?", "Yes", "No");
if (n == 0)
quit = true;
else
quit = false;
Assembly: Terminal.Gui.dll
Syntax
public static class MessageBox : Object
Properties
Clicked
The index of the selected button, or -1 if the user pressed ESC to close the dialog.
This is useful for web based console where by default there is no SynchronizationContext or TaskScheduler.
Declaration
public static int Clicked { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
ErrorQuery(ustring, ustring, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int ErrorQuery(ustring title, ustring message, params ustring[] buttons)
Parameters
Type |
Name |
Description |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
ErrorQuery(ustring, ustring, Int32, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int ErrorQuery(ustring title, ustring message, int defaultButton = 0, params ustring[] buttons)
Parameters
Type |
Name |
Description |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
ErrorQuery(ustring, ustring, Int32, Border, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int ErrorQuery(ustring title, ustring message, int defaultButton = 0, Border border = null, params ustring[] buttons)
Parameters
Type |
Name |
Description |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
Border |
border |
The border settings. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
ErrorQuery(Int32, Int32, ustring, ustring, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int ErrorQuery(int width, int height, ustring title, ustring message, params ustring[] buttons)
Parameters
Type |
Name |
Description |
System.Int32 |
width |
Width for the window. |
System.Int32 |
height |
Height for the window. |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
ErrorQuery(Int32, Int32, ustring, ustring, Int32, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int ErrorQuery(int width, int height, ustring title, ustring message, int defaultButton = 0, params ustring[] buttons)
Parameters
Type |
Name |
Description |
System.Int32 |
width |
Width for the window. |
System.Int32 |
height |
Height for the window. |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
ErrorQuery(Int32, Int32, ustring, ustring, Int32, Border, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int ErrorQuery(int width, int height, ustring title, ustring message, int defaultButton = 0, Border border = null, params ustring[] buttons)
Parameters
Type |
Name |
Description |
System.Int32 |
width |
Width for the window. |
System.Int32 |
height |
Height for the window. |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
Border |
border |
The border settings. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
Query(ustring, ustring, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int Query(ustring title, ustring message, params ustring[] buttons)
Parameters
Type |
Name |
Description |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
Query(ustring, ustring, Int32, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int Query(ustring title, ustring message, int defaultButton = 0, params ustring[] buttons)
Parameters
Type |
Name |
Description |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
Query(ustring, ustring, Int32, Border, ustring[])
Presents an error
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int Query(ustring title, ustring message, int defaultButton = 0, Border border = null, params ustring[] buttons)
Parameters
Type |
Name |
Description |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
Border |
border |
The border settings. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
Query(Int32, Int32, ustring, ustring, ustring[])
Presents a normal
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int Query(int width, int height, ustring title, ustring message, params ustring[] buttons)
Parameters
Type |
Name |
Description |
System.Int32 |
width |
Width for the window. |
System.Int32 |
height |
Height for the window. |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
Query(Int32, Int32, ustring, ustring, Int32, ustring[])
Presents a normal
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int Query(int width, int height, ustring title, ustring message, int defaultButton = 0, params ustring[] buttons)
Parameters
Type |
Name |
Description |
System.Int32 |
width |
Width for the window. |
System.Int32 |
height |
Height for the window. |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |
Query(Int32, Int32, ustring, ustring, Int32, Border, ustring[])
Presents a normal
MessageBox with the specified title and message and a list of buttons to show to the user.
Declaration
public static int Query(int width, int height, ustring title, ustring message, int defaultButton = 0, Border border = null, params ustring[] buttons)
Parameters
Type |
Name |
Description |
System.Int32 |
width |
Width for the window. |
System.Int32 |
height |
Height for the window. |
NStack.ustring |
title |
Title for the query. |
NStack.ustring |
message |
Message to display, might contain multiple lines. |
System.Int32 |
defaultButton |
Index of the default button. |
Border |
border |
The border settings. |
NStack.ustring[] |
buttons |
Array of buttons to add. |
Returns
Type |
Description |
System.Int32 |
The index of the selected button, or -1 if the user pressed ESC to close the dialog. |