The MessageBox class

The MessageBox class
This class provides a simple way of popping up a message box window for the user. The following lines of code present a pop up messagebox with a warning and query the user to click Yes or No.
var ans = MessageBox.warning( "Do you wish to save the data?", MessageBox.Yes, MessageBox.No );
if (ans == MessageBox.Yes) {
    save();
}
The button types are used to describe what the text of the buttons should be. The following are available.
  • NoButton; No button is displayed.

  • Ok; Displays an 'OK' button.

  • Cancel; Displays a 'Cancel' button.

  • Yes; Displays a 'Yes' button.

  • No; Displays a 'No' button.

  • Abort; Displays an 'Abort' button.

  • Retry; Displays a 'Retry' button.

  • Ignore; Displays an 'Ignore' button.

The following is a list of message box functions. The button1, button2 and button3 parameters can be any of the Button types described above and specify which button types will be shown in the message box. Each function returns the button type that the user pressed.
  • information( label : String, button1 : ButtonType, button2 : ButtonType, button3 : ButtonType, title : String ); Displays an information message box with the content specified in label.

  • warning( label : String, button1 : ButtonType, button2 : ButtonType, button3 : ButtonType, title : String ); Displays a warning message box with the content specified in label.

  • critical( label : String, button1 : ButtonType, button2 : ButtonType, button3 : ButtonType, title : String ) Displays a critical error message box with the content specified in label.