MessageBox
This object represents a window showing some text to the user.
Functions
MessageBox
Syntax
var myObject = new MessageBox();
var myObject = new MessageBox(parameters);
Arguments
parameters - (object) window parameters
title - (string) the window's title
position - (
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)
-
icon - (
Icon) the number of decimals
-
escapeButton - (
StandardButton) the button pressed when pressing escape
onClosed - (
OnClosed) event called when the window is closed
Exceptions
Example
var myObject = new MessageBox();
var myObject = new MessageBox({
title: "Press yes or no",
icon: MessageBox.Warning,
buttons: MessageBox.Yes | MessageBox.No
});
Methods
setTitle
Syntax
myObject.setTitle(title);
Arguments
title - (string) the window's title
Returns
setPosition
Sets the window's position.
Syntax
myObject.setPosition(point);
Arguments
point - (
Point) the window's position
Returns
setOpacity
Sets the window's opacity.
Syntax
myObject.setOpacity(opacity);
Arguments
opacity - (float) the window's opacity
Returns
setEnabled
Sets the window's enabled status.
Syntax
myObject.setEnabled(enabled);
Arguments
enabled - (boolean) the window's enabled status
Returns
setVisible
Sets the window's visible status.
Syntax
myObject.setVisible(visible);
Arguments
visible - (boolean) the window's visible status
Returns
close
Syntax
Returns
title
Returns the window's title.
Syntax
Returns
position
Returns the window's position.
Syntax
Returns
(
Point) the window's position
opacity
Returns the window's opacity.
Syntax
Returns
enabled
Returns the window's enabled status.
Syntax
Returns
visible
Returns the window's visible status.
Syntax
Returns
setText
Syntax
Arguments
Returns
setDetailedText
Syntax
myObject.setDetailedText(detailedText);
Arguments
detailedText - (string) the detailed text
Returns
setInformativeText
Sets the informative text (appended to text).
Syntax
myObject.setInformativeText(informativeText);
Arguments
informativeText - (string) the informative text
Returns
Syntax
myObject.setButtons(buttons);
Arguments
Returns
setIcon
Syntax
Arguments
buttons - (
Icon) the icon to use
Returns
Sets the default selected button.
Syntax
myObject.setDefaultButton(button);
Arguments
Returns
Sets the button pressed when pressing the escape key.
Syntax
myObject.setEscapeButton(button);
Arguments
button - (
StandardButton) the button pressed when pressing the escape key
Returns
Syntax
myObject.addCustomButton(button, text);
Arguments
button - (
StandardButton) the standard button corresponding to this custom button
text - (string) the text of this button
Returns
Exceptions
show
Show the window. (non-blocking)
Use the OnClosed event to know when the window has been closed.
Syntax
Returns
showModal
Show the window. (blocking)
Syntax
Returns
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. (Point)
opacity
The window's opacity. (float)
enabled
The window's enabled status. (boolean)
visible
The window's visible status. (boolean)
Enumerations
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
Values
NoIcon: no icon
Question: a question mark icon
Information: an information icon
Warning: a warning icon
Critical: a critical icon (error)