Dialogs
You can use a Dialog widget to create a modal view for almost any
purpose. A custom dialog is a conventional dialog,
but it requires a widget assistant and an HTML template file. The Dialog
widget is dynamically instantiated within a scene assistant, so there is a
bit of overhead in using it both for you as a developer and at runtime.
For errors, you should use the Error dialog. For presenting some simple options, use an
Alert dialog. The simple built-in dialogs will be presented
first, followed by a discussion of how to build custom dialogs with
showDialog.
Error Dialog
You can 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; an example is shown in Figure 4-1.
You can post an Error dialog box with a single call:
Mojo.Controller.errorDialog(“Invalid Feed”, this.controller.window);

Figure 4-1. An Error dialog box
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access