Displays a GUI message box with text, icon and buttons.
MessageBox(s[, i][, b[, db[, cb]]])
iis a string
bis a list of strings
dbis a string
cbis a string
MessageBox function displays a message box with text, optionally with an icon, and with a custom set of buttons.
sis the text of the message box.
iis the type of icon. If present, it must be one of
"error". The icon may be accompanied by a distinctive sound. Both the visual icon bitmap and the sound are provided by the operating system and may be affected by system settings. If omitted, no icon is displayed.
bis a list of the dialog’s buttons. Each element is a string which is used both as the caption of the button and as its identifier. An caption may contain an ampersand character indicating that the next character is the button’s accelerator. To include an actual ampersand character, write
&&. If omitted,
dbspecifies the default button. This must be one of the elements of
b(*). If omitted, the first button becomes the default button.
cbspecifies the cancel button. This must be one of the elements of
b(*). If omitted, there is no cancel button. The cancel button is the one that responds to the Escape key and the one that is implicitly chosen if the user closes the dialog box without clicking one of the buttons, typically by clicking the Close title bar button, choosing the Close system menu item, or pressing Alt+F4. If
cbis not specified, there will be no Close system menu item or Close title bar button, and the dialog can be closed neither by Escape or by Alt+F4.
(*) Accelerator characters in
b are ignored.
The function returns the caption of the chosen button, without any accelerator ampersand. Please note that this function doesn’t return without user intervention.
MessageBox("The value of π is " + π + ".", "information")
if(MessageBox("Do you want to exit?", '("&Yes", "&No"), "Yes", "No") = "Yes", exit())
MessageBox("There might be a nargle nearby.", "warning", '("Okay, I’ll be careful."))