dialog(message, [title], [buttons], [icon], [window])

Description:

Shows a custom dialog window that allows the user to respond by clicking one of provided buttons.

Parameters:

Name Type Default Description

message

string

String message to user. It can be plain text or HTML.

[title]

string

""

Dialog window title shown in the title bar of the window

[buttons]

Array.<string>

["OK","Cancel"]

An Array of button names. Indicate a default button by surrounding the text with square brackets like so: "[Cancel]"

[icon]

MessageIcon | string

null

One of MessageIcon icons, or an absolute path to an image from a file system.

[window]

Window

null

Owner window that will be overlaid by this dialog window. If omitted, last created visible Window that's not PopUp will be used.

Returns:

Returns a zero-based number of a clicked button, or null if the dialog window was closed without clicking provided buttons.

Type: number | undefined

Examples:

Usage example

let response = dialog("Are you ready?", "Confirm readiness", ["Yes", "No", "[Maybe]"], MessageIcon.Question, window);
switch(response)
{
    case 0: return "Yes";
    case 1: return "No";
    case 2: return "Maybe";
}

Using custom image

let response = dialog("Is this you?", "Question #5", ["Yes","[No]"], "C://User/John/profile_icon.jpg", window);