ConfirmationDialog
- Since:
Methods
-
async show() → {number}
-
Display the dialog. Every time
show()is called, a new dialog opens, with a unique ID.Returns:
number - The unique ID of the dialog that opens.- Since:
-
withButtons(button0Label, button1Labelopt, button2Labelopt) → {mobicontrol.message.ConfirmationDialog}
-
Set the custom buttons for the dialog.
Parameters:
Name Type Attributes Description button0Labelstring The first button's label (cannot be an empty string). button1Labelstring <optional>
The second button's label (cannot be an empty string). button2Labelstring <optional>
The third button's label (cannot be an empty string). Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
Example
var buttonLabels = ['Red', 'Green', 'Blue']; mobicontrol.message.createInfoDialog('Choose the colour.') .withButtons(buttonLabels[0], buttonLabels[1], buttonLabels[2]) .withCallback(onConfirm).show(); function onConfirm(result) { if (result.buttonIndex != null) { mobicontrol.log.info('The ' + buttonLabels[result.buttonIndex] + ' button was clicked.'); } } -
withCallback(callbackFunction) → {mobicontrol.message.ConfirmationDialog}
-
Set a callback function for the dialog. The callback function is called when the dialog is closed. For example, when the dialog times out, or a button is clicked, or the dialog is dismissed.
Parameters:
Name Type Description callbackFunctionmobicontrol.message.ConfirmationDialog.ConfirmationDialogCallback The callback function for this dialog. Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
Example
mobicontrol.message.createYesNoDialog('Would you like to reboot now?') .withCallback(onConfirm).show(); function onConfirm(result) { if (result.isYesButton) { mobicontrol.log.info('The Yes button was clicked'); } else if (result.isNoButton) { mobicontrol.log.info('The No button was clicked'); } else if (result.isDismissed) { mobicontrol.log.info('The dialog was dismissed'); } } -
withErrorIcon() → {mobicontrol.message.ConfirmationDialog}
-
Set the error icon for the dialog.
Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
Example
mobicontrol.message.createInfoDialog('Error occurred!') .withErrorIcon().show(); -
withInfoIcon() → {mobicontrol.message.ConfirmationDialog}
-
Set the info icon for the dialog.
Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
-
withNotification() → {mobicontrol.message.ConfirmationDialog}
-
Set notification for the dialog. Make the dialog create a notification when shown.
Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
Example
mobicontrol.message.createInfoDialog('This dialog has a notification.') .withNotification().show(); -
withQuestionIcon() → {mobicontrol.message.ConfirmationDialog}
-
Set the question icon for the dialog.
Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
-
withTimer(timeoutInMillis) → {mobicontrol.message.ConfirmationDialog}
-
Set the timeout for the dialog. The dialog is dismissed automatically when the timeout expires.
Parameters:
Name Type Description timeoutInMillisnumber The timeout in milliseconds. Must be greater than zero. Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
Example
mobicontrol.message.createInfoDialog('This dialog will be dismissed in 5 seconds.') .withTimer(5000).show(); -
withTitle(title) → {mobicontrol.message.ConfirmationDialog}
-
Set the title for the dialog.
Parameters:
Name Type Description titlestring The title for this dialog. Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
Example
mobicontrol.message.createInfoDialog('This dialog has a non-default title.') .withTitle('Test title').show(); -
withWarnIcon() → {mobicontrol.message.ConfirmationDialog}
-
Set the warning icon for the dialog.
Returns:
mobicontrol.message.ConfirmationDialog - This dialog.- Since:
Type Definitions
-
ConfirmationDialogCallback(result)
-
Callback function for mobicontrol.message.ConfirmationDialog.withCallback.
Parameters:
Name Type Description resultobject Result of the dialog interaction. Properties
Name Type Description isYesButtonboolean trueif the Yes button was clicked. This property istrueif the dialog has the standard Yes button, and this button was clicked;falseotherwise.
Note: If the dialog has custom buttons set bywithButtons, and the clicked button is labeled 'Yes', this property isfalse.isNoButtonboolean trueif the No button was clicked. This property istrueif the dialog has the standard No button, and this button was clicked;falseotherwise.
Note: If the dialog has custom buttons set bywithButtons, and the clicked button is labeled 'No', this property isfalse.isCancelButtonboolean trueif the Cancel button was clicked. This property istrueif the dialog has the standard Cancel button, and this button was clicked;falseotherwise.
Note: If the dialog has custom buttons set bywithButtons, and the clicked button is labeled 'Cancel', this property isfalse.isOkButtonboolean trueif the OK button was clicked. This property istrueif the dialog has the standard OK button, and this button was clicked;falseotherwise.
Note: If the dialog has custom buttons set bywithButtons, and the clicked button is labeled 'OK', this property isfalse.buttonIndexnumber The index of the button that was pressed. This property is nullif no button was pressed.isDismissedboolean trueif the dialog was dismissed,falseotherwise. A dialog is considered dismissed if it was closed as a result of event other than a dialog's button click. For example, by expiry of its timer or by a click on the Back button in the navigation bar.isTimedOutboolean trueif the dialog was dismissed due to a timeout,falseotherwise.dialogIdnumber The unique ID of the dialog. buttonLabelstring The label of the clicked button. If the dialog has no custom buttons, this is the English label in all caps. - Since: