ssCore.App.showMsgBox

Display a Windows message box and find out which button is used to dismiss the message box.


Availability:

First available in version 3.0 build 2039.


Input Parameters:

icon - [Optional] - Indicates which icon (if any) should be displayed in the message box, the default is no icon. Valid values include: critical, information, question, and exclamation.

buttons - [Optional] - Indicates which buttons should appear in the message box, the default is the OK button. Valid values include: OkOnly, OkCancel, YesNo, YesNoCancel, AbortRetryIgnore, and RetryCancel.

defaultButton - [Optional] - Identifies which of the available buttons should be the 'default' button (fired when the user presses the enter key), the default is BUTTON1. Valid values include: button1, button2, and button3.

prompt - The prompt to be displayed in the message box. Newline and tab characters may be used.

title - [Optional] - Text that should appear in the title bar of the message box, the default is the current application title.

forceShow - [Optional] - Forces SWF Studio to display the message box even if the window is hidden or minimized. If not specified, the default value is false. Valid values include: false and true.


Output Parameters:

result - Returns the name of the button that was pressed to dismiss the messagebox. Possible return values are an empty string (in case of an error) or one of YES,NO,OK,CANCEL,ABORT,RETRY,IGNORE. If the user dismisses the message box using the close (X) button, the default button is returned (most often this is the OK button.


Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.App.showMsgBox( paramsObject [, callbackParamsObject] [, errorParamsObject] );


Synchronous Mode:

When this method is called synchronously, a return object containing the output parameters is returned to the caller immediately.

var returnObject = ssCore.App.showMsgBox( paramsObject );


Notes:

A message box contains an application-defined message (prompt) and title, plus a combination of predefined icons and push buttons. The App.showMsgBox not only makes it possible to display these message boxes but to find out which button the user pressed to close the message box. This allows you to get simple answers from with your users in a way they are familiar with and with very little effort.


Examples:

The following example opens a message box with Yes and No buttons. The value of the chosen button is displayed in the SWF Studio Trace tab.

// Make sure the window is visible.
ssCore.Win.show();

var return_obj = ssCore.App.showMsgBox({icon:"question", buttons:"YesNo", defaultButton:"button2", prompt:"Are you sure?"});

ssDebug.trace(return_obj.result);