You can use the system dialog controls
to pause your application flow and communicate important information to
the user. System dialogs can be used to ask the user to confirm an
action, notify the user of an event, or prompt the user for additional
information.
SystemDialog
You can use a SystemDialog control to ask the user to confirm an action (see Listing 1). (Note that you need to import the bb.system 1.2 library.)
Listing 1. SystemDialog with User Confirmation
import bb.cascades 1.2 import bb.system 1.2 Page { Container { layout: DockLayout { } Button { text: "Show Dialog!" verticalAlignment: VerticalAlignment.Center horizontalAlignment: HorizontalAlignment.Center onClicked: { myDialog.show(); } } attachedObjects: [ SystemDialog { title: "Save Changes" id: myDialog onFinished: { switch (value) { case (SystemUiResult.ConfirmButtonSelection): console.log("save confirmed"); break; case (SystemUiResult.CancelButtonSelection): console.log("save canceled"); break; default: break; } } } ] } }
To display the dialog, you need to call SystemDialog.show(). To determine the user’s selection, you need to handle the SystemDialog.finished() signal. The SystemDialog’s text property will be displayed on the dialog’s title bar (see Figure 1).

No comments:
Post a Comment