Table of Contents

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

  1. 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)
    • buttons - (StandardButton) a flag list of buttons
    • icon - (Icon) the number of decimals
    • defaultButton - (StandardButton) the default selected button
    • 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

Sets the window's title.

Syntax

myObject.setTitle(title);

Arguments

  1. title - (string) the window's title

Returns

setPosition

Sets the window's position.

Syntax

myObject.setPosition(point);

Arguments

  1. point - (Point) the window's position

Returns

setOpacity

Sets the window's opacity.

Syntax

myObject.setOpacity(opacity);

Arguments

  1. opacity - (float) the window's opacity

Returns

setEnabled

Sets the window's enabled status.

Syntax

myObject.setEnabled(enabled);

Arguments

  1. enabled - (boolean) the window's enabled status

Returns

setVisible

Sets the window's visible status.

Syntax

myObject.setVisible(visible);

Arguments

  1. visible - (boolean) the window's visible status

Returns

close

Closes the window.

Syntax

myObject.close();

Returns

title

Returns the window's title.

Syntax

myObject.title();

Returns

position

Returns the window's position.

Syntax

myObject.position();

Returns

opacity

Returns the window's opacity.

Syntax

myObject.opacity();

Returns

enabled

Returns the window's enabled status.

Syntax

myObject.enabled();

Returns

visible

Returns the window's visible status.

Syntax

myObject.visible();

Returns

setText

Sets the text.

Syntax

myObject.setText(text);

Arguments

  1. text - (string) the text

Returns

setDetailedText

Sets the detailed text.

Syntax

myObject.setDetailedText(detailedText);

Arguments

  1. detailedText - (string) the detailed text

Returns

setInformativeText

Sets the informative text (appended to text).

Syntax

myObject.setInformativeText(informativeText);

Arguments

  1. informativeText - (string) the informative text

Returns

setButtons

Sets the buttons to use.

Syntax

myObject.setButtons(buttons);

Arguments

  1. buttons - (StandardButton) the buttons to use (flag)

Returns

setIcon

Sets the icon to use.

Syntax

myObject.setIcon(icon);

Arguments

  1. buttons - (Icon) the icon to use

Returns

setDefaultButton

Sets the default selected button.

Syntax

myObject.setDefaultButton(button);

Arguments

  1. button - (StandardButton) the default button

Returns

setEscapeButton

Sets the button pressed when pressing the escape key.

Syntax

myObject.setEscapeButton(button);

Arguments

  1. button - (StandardButton) the button pressed when pressing the escape key

Returns

addCustomButton

Adds a custom button.

Syntax

myObject.addCustomButton(button, text);

Arguments

  1. button - (StandardButton) the standard button corresponding to this custom button
  2. 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

myObject.show();

Returns

showModal

Show the window. (blocking)

Syntax

myObject.showModal();

Returns

Events

onClosed

Called when the window is closed.

Syntax

myObject.onClosed = function(result) {};

Arguments

  1. 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

StandardButton

A standard button.

Values

  1. Ok: an "ok" button
  2. Open: an "open" button
  3. Save: a "save" button
  4. Cancel: a "cancel" button
  5. Close: a "close" button
  6. Discard: a "discard" button
  7. Apply: an "apply" button
  8. Reset: a "reset" button
  9. RestoreDefaults: a "restore defaults" button
  10. Help: a "help" button
  11. SaveAll: a "save all" button
  12. Yes: a "yes" button
  13. YesToAll: a "yes to all" button
  14. No: a "no" button
  15. NoToAll: a "no to all" button
  16. Abort: an "abort" button
  17. Retry: a "retry" button
  18. Ignore: an "ignore" button
  19. 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

  1. NoIcon: no icon
  2. Question: a question mark icon
  3. Information: an information icon
  4. Warning: a warning icon
  5. Critical: a critical icon (error)