This method opens a built-in modal dialog. The
basics::dictionary object parameter
can contain the following keys:
- titleText - The label for the dialog window title.
- bodyText - The label for the dialog body.
- subText - The label below the body text.
- dialogType - The dialog type. Possible values are:
- alert - Alert dialog box
- confirm - Confirm dialog box
- prompt - Prompt dialog box
- checkboxConfirm - Confirm dialog box with checkbox
- confirmButton - Custom label for the confirm button.
- cancelButton - Custom label for the cancel button
- alternateButton - Label for an alternate button. This will add an extra
button to the right of the existing buttons.
- results - An object that will have 3 properties set on return
- results - boolean. True is ok/yes button was pressed, else false.
- checked - boolean. True is check box is checked.
- inputText - string. The string that was entered in the input box.
- buttonLabel - string. The label of the button pressed.
- checked - Set to "true" to have checkbox checked when dialog displays. This
key is only valid for 'checkboxConfirm' dialog type
- checkText - The label to use with the checkbox on the dialog. This key is
only valid for 'checkboxConfirm' dialog type.
- inputText - The text to pre-populate the input box for prompt dialogs. This
key is only valid for 'prompt' dialog type.
- windowIcon - The image file to use as the window icon. (i.e
box://ocpToolkit/resources/aol_logo.png)
- messageIcon - The image file to use as the message icon. (i.e
box://ocpToolkit/resources/myMessageIcon.png)
- errorCode - The error code string to display in the dialog.
- size - The size of the dialog. Possible values are:
- auto - The dialog height will auto size to text.
- custom - The dialog will use the values that are specified in the width
and height keys or the dictionary.
- small - The dialog size will be 250 X 125.
- medium - The dialog size will be 350 X 240.
- large - The dialog size will be 450 X 310.
- width - The custom width of the dialog window. The 'size' key must be set
to 'custom.'
- height - The custom height of the dialog window. The 'size' key must be
set to 'custom.'
- centerOverBox - The box proxy object to center the dialog over. If this is
not given or null the dialog will be center on the desktop.
function onSample()
{
var results = new Object();
var params = shell.serviceManager.basics.dictionary;
params.setValueForKey("Hello World", "titleText");
params.setValueForKey("Hello Boxely world", "bodyText");
params.setValueForKey("alert", "dialogType");
params.setValueForKey(results, "results");
scene.openDialog(params);
if (results.results)
{
// confirmed
}
else
{
// cancelled
}
}