Dialogs

This section includes the three Mojo dialog APIs:

  • Error dialog

  • Alert dialog

  • Custom dialog

Each entry includes a brief description, repeating some of the information from Chapter 4, followed by an enumeration of the arguments. Dialogs are accessed through a direct API so the format for this entry will be structured as an API entry.

Mojo.Controller.errorDialog()

This API is used to post error messages in a modal dialog box with a fixed title of “Error,” a customizable message, and a confirmation button. The Error dialog must be used only with errors, since you can’t change the title.

Arguments

Type

Description

message

String

Displayed message in a modal dialog

window

Element

Optional argument to specify the window to post the alert within; required in multistage applications

Mojo.Controller.SceneController.showAlertDialog()

You can display a short message using an Alert dialog, with one or more HTML buttons presenting the selection options. This is the best option if you have either a nonerror message for the user or want to present options in the form of button selections.

Arguments

Type

Description

onChoose
FunctionHandler called when user makes a choice and the dialog is dismissed
message

String

Displayed message in a modal dialog

title

String

Title of the dialog box

preventCancel

Boolean

If true, back gesture or other alerts will not cancel the dialog box

choices

Array

Array of button descriptions; each entry is required to be:

{label: 'string', value: value, type: 'string', allowHTMLMessage: boolean} ...

Get Palm webOS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.