====== MessageBox ======
This object represents a window showing some text to the user.
===== Functions =====
==== MessageBox ====
Constructor function.
=== Syntax ===
var myObject = new MessageBox();
var myObject = new MessageBox(parameters);
=== Arguments ===
- parameters - (object) window parameters
* title - (string) the window's title
* position - ([[en:code:core:point|Point]]) the window's position
* opacity - (float) the window's opacity
* enabled - (boolean) the window's enabled status
* visible - (boolean) the window's visible status
* text - (string) the text
* detailedText - (string) the detailed text
* informativeText - (string) the informative text (appended to text)
* buttons - ([[#standardbutton|StandardButton]]) a flag list of buttons
* icon - ([[#icon|Icon]]) the number of decimals
* defaultButton - ([[#standardbutton|StandardButton]]) the default selected button
* escapeButton - ([[#standardbutton|StandardButton]]) the button pressed when pressing escape
* onClosed - ([[#onclosed|OnClosed]]) event called when the window is closed
=== Exceptions ===
* (ParameterTypeError) incorrect parameter type
* (ParameterCountError) incorrect parameter count
=== Example ===
var myObject = new MessageBox();
var myObject = new MessageBox({
title: "Press yes or no",
icon: MessageBox.Warning,
buttons: MessageBox.Yes | MessageBox.No
});
===== Methods =====
==== setTitle ====
Sets the window's title.
=== Syntax ===
myObject.setTitle(title);
=== Arguments ===
- title - (string) the window's title
=== Returns ===
* (MessageBox) this MessageBox
==== setPosition ====
Sets the window's position.
=== Syntax ===
myObject.setPosition(point);
=== Arguments ===
- point - ([[en:code:core:point|Point]]) the window's position
=== Returns ===
* (MessageBox) this MessageBox
==== setOpacity ====
Sets the window's opacity.
=== Syntax ===
myObject.setOpacity(opacity);
=== Arguments ===
- opacity - (float) the window's opacity
=== Returns ===
* (MessageBox) this MessageBox
==== setEnabled ====
Sets the window's enabled status.
=== Syntax ===
myObject.setEnabled(enabled);
=== Arguments ===
- enabled - (boolean) the window's enabled status
=== Returns ===
* (MessageBox) this MessageBox
==== setVisible ====
Sets the window's visible status.
=== Syntax ===
myObject.setVisible(visible);
=== Arguments ===
- visible - (boolean) the window's visible status
=== Returns ===
* (MessageBox) this MessageBox
==== close ====
Closes the window.
=== Syntax ===
myObject.close();
=== Returns ===
* (MessageBox) this MessageBox
==== title ====
Returns the window's title.
=== Syntax ===
myObject.title();
=== Returns ===
* (string) the window's title
==== position ====
Returns the window's position.
=== Syntax ===
myObject.position();
=== Returns ===
* ([[en:code:core:point|Point]]) the window's position
==== opacity ====
Returns the window's opacity.
=== Syntax ===
myObject.opacity();
=== Returns ===
* (float) the window's opacity
==== enabled ====
Returns the window's enabled status.
=== Syntax ===
myObject.enabled();
=== Returns ===
* (boolean) the window's enabled status
==== visible ====
Returns the window's visible status.
=== Syntax ===
myObject.visible();
=== Returns ===
* (boolean) the window's visible status
==== setText ====
Sets the text.
=== Syntax ===
myObject.setText(text);
=== Arguments ===
- text - (string) the text
=== Returns ===
* (MessageBox) this MessageBox
==== setDetailedText ====
Sets the detailed text.
=== Syntax ===
myObject.setDetailedText(detailedText);
=== Arguments ===
- detailedText - (string) the detailed text
=== Returns ===
* (MessageBox) this MessageBox
==== setInformativeText ====
Sets the informative text (appended to text).
=== Syntax ===
myObject.setInformativeText(informativeText);
=== Arguments ===
- informativeText - (string) the informative text
=== Returns ===
* (MessageBox) this MessageBox
==== setButtons ====
Sets the buttons to use.
=== Syntax ===
myObject.setButtons(buttons);
=== Arguments ===
- buttons - ([[#standardbutton|StandardButton]]) the buttons to use (flag)
=== Returns ===
* (MessageBox) this MessageBox
==== setIcon ====
Sets the icon to use.
=== Syntax ===
myObject.setIcon(icon);
=== Arguments ===
- buttons - ([[#icon|Icon]]) the icon to use
=== Returns ===
* (MessageBox) this MessageBox
==== setDefaultButton ====
Sets the default selected button.
=== Syntax ===
myObject.setDefaultButton(button);
=== Arguments ===
- button - ([[#standardbutton|StandardButton]]) the default button
=== Returns ===
* (MessageBox) this MessageBox
==== setEscapeButton ====
Sets the button pressed when pressing the escape key.
=== Syntax ===
myObject.setEscapeButton(button);
=== Arguments ===
- button - ([[#standardbutton|StandardButton]]) the button pressed when pressing the escape key
=== Returns ===
* (MessageBox) this MessageBox
==== addCustomButton ====
Adds a custom button.
=== Syntax ===
myObject.addCustomButton(button, text);
=== Arguments ===
- button - ([[#standardbutton|StandardButton]]) the standard button corresponding to this custom button
- text - (string) the text of this button
=== Returns ===
* (MessageBox) this MessageBox
=== Exceptions ===
* (AddCustomButtonError) add custom button failed
==== show ====
Show the window. (non-blocking)
Use the [[#onclosed|OnClosed]] event to know when the window has been closed.
=== Syntax ===
myObject.show();
=== Returns ===
* (MessageBox) this MessageBox
==== showModal ====
Show the window. (blocking)
=== Syntax ===
myObject.showModal();
=== Returns ===
* (integer) the window result (0 means that it has been canceled)
===== Events =====
==== onClosed ====
Called when the window is closed.
=== Syntax ===
myObject.onClosed = function(result) {};
=== Arguments ===
- result - (integer) the window result (0 means that it has been canceled)
=== Example ===
myObject.onClosed = function(result)
{
if(result)
{
//Event action
}
};
===== Attributes =====
==== title ====
The window's title. (string)
==== position ====
The window's position. ([[en:code:core:point|Point]])
==== opacity ====
The window's opacity. (float)
==== enabled ====
The window's enabled status. (boolean)
==== visible ====
The window's visible status. (boolean)
===== Enumerations =====
==== StandardButton ====
A standard button.
=== Values ===
- Ok: an "ok" button
- Open: an "open" button
- Save: a "save" button
- Cancel: a "cancel" button
- Close: a "close" button
- Discard: a "discard" button
- Apply: an "apply" button
- Reset: a "reset" button
- RestoreDefaults: a "restore defaults" button
- Help: a "help" button
- SaveAll: a "save all" button
- Yes: a "yes" button
- YesToAll: a "yes to all" button
- No: a "no" button
- NoToAll: a "no to all" button
- Abort: an "abort" button
- Retry: a "retry" button
- Ignore: an "ignore" button
- NoButton: no button
=== Notes ===
This is a flag enumeration, this means that you can use multiple values using the | operator.
Example :
myObject.setButtons(MessageBox.Yes | MessageBox.Save); //Show yes and save buttons
==== Icon ====
An icon.
=== Values ===
- NoIcon: no icon
- Question: a question mark icon
- Information: an information icon
- Warning: a warning icon
- Critical: a critical icon (error)