Chapter 4. Dialogs and Menus

Familiar components in every UI framework, dialog boxes and menus are used by almost all applications. Mojo’s Dialog and Menu widgets provide the expected features, but have some unique additions. With custom dialogs, you can include any web content in a dialog box. Additionally, you can customize menus by scene and present them as either conventional drop-down lists or floating elements.

Dialogs and menus are both fundamental widgets, though more complex than the basic widgets covered in Chapter 3, and they are accessed and managed differently than other widgets. Dialogs are instantiated through controller functions rather than through setupWidget, and showDialog requires an assistant as one of its components.

Menus are instantiated by setupWidget, but use the Commander Chain to propagate menu commands between stage assistants and scene assistants. The Commander Chain is a model for propagating commands through the application, stage, and scene controllers, and is described in detail near the end of this chapter.

As in Chapter 3, we’ll explore these widgets in the context of adding them into the News application. This will be accompanied by a general description and some screenshots.

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.