Search Results for

    Show / Hide Table of Contents

    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
    object
    MessageBox
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Terminal.Gui
    Assembly: Terminal.Gui.dll
    Syntax
    public static class 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;

    Properties

    | Edit this page View Source

    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
    int

    Methods

    | Edit this page View Source

    ErrorQuery(ustring, ustring, params 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
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    The message box will be vertically and horizontally centered in the container and the size will be automatically determined from the size of the title, message. and buttons.
    | Edit this page View Source

    ErrorQuery(ustring, ustring, int, params 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
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    The message box will be vertically and horizontally centered in the container and the size will be automatically determined from the size of the title, message. and buttons.
    | Edit this page View Source

    ErrorQuery(ustring, ustring, int, Border, params 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
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    Border border The border settings.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    The message box will be vertically and horizontally centered in the container and the size will be automatically determined from the size of the title, message. and buttons.
    | Edit this page View Source

    ErrorQuery(int, int, ustring, ustring, params 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
    int width Width for the window.
    int height Height for the window.
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    Use ErrorQuery(ustring, ustring, params ustring[]) instead; it automatically sizes the MessageBox based on the contents.
    | Edit this page View Source

    ErrorQuery(int, int, ustring, ustring, int, params 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
    int width Width for the window.
    int height Height for the window.
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    Use ErrorQuery(ustring, ustring, params ustring[]) instead; it automatically sizes the MessageBox based on the contents.
    | Edit this page View Source

    ErrorQuery(int, int, ustring, ustring, int, Border, params 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
    int width Width for the window.
    int height Height for the window.
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    Border border The border settings.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    Use ErrorQuery(ustring, ustring, params ustring[]) instead; it automatically sizes the MessageBox based on the contents.
    | Edit this page View Source

    Query(ustring, ustring, params 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
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    The message box will be vertically and horizontally centered in the container and the size will be automatically determined from the size of the message and buttons.
    | Edit this page View Source

    Query(ustring, ustring, int, params 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
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    The message box will be vertically and horizontally centered in the container and the size will be automatically determined from the size of the message and buttons.
    | Edit this page View Source

    Query(ustring, ustring, int, Border, params 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
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    Border border The border settings.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    The message box will be vertically and horizontally centered in the container and the size will be automatically determined from the size of the message and buttons.
    | Edit this page View Source

    Query(int, int, ustring, ustring, params 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
    int width Width for the window.
    int height Height for the window.
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    Use Query(ustring, ustring, params ustring[]) instead; it automatically sizes the MessageBox based on the contents.
    | Edit this page View Source

    Query(int, int, ustring, ustring, int, params 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
    int width Width for the window.
    int height Height for the window.
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    Use Query(ustring, ustring, params ustring[]) instead; it automatically sizes the MessageBox based on the contents.
    | Edit this page View Source

    Query(int, int, ustring, ustring, int, Border, params 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
    int width Width for the window.
    int height Height for the window.
    ustring title Title for the query.
    ustring message Message to display, might contain multiple lines.
    int defaultButton Index of the default button.
    Border border The border settings.
    ustring[] buttons Array of buttons to add.
    Returns
    Type Description
    int The index of the selected button, or -1 if the user pressed ESC to close the dialog.
    Remarks
    Use Query(ustring, ustring, params ustring[]) instead; it automatically sizes the MessageBox based on the contents.
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX