Logic to Display and Close a Dialog
You can open a dialog in the following ways:
Open a dialog in response to a listener event.
If you want to open a dialog in response to a listener event, add an
OpenDialog object to the model and select the name of the dialog you want to open for the
OpenDialog object’s
Dialog property. For more information, see
Responding to user-initiated events and
OpenDialog Properties.
Open a dialog by creating the dialog class.
To create the dialog class, invoke the class that Mobile Development generates for the dialog, for example, MyAlertDialog.java, where “MyAlertDialog” is the value you specified for the AlertDialog object’s Class Name property. For example:
call new MyAlertDialog(delegate).open();
In the code line to create the dialog, delegate is an instance of iDialogDelegate. By default, all abstract controllers implement iDialogDelegate.
Open a dialog by invoking the
openDialog method, which is in the
AbstractApplicationController.java in the gen/api-src folder in the
com.softwareag.mobile.runtime.toolkit package. In this case, pass a generated instance of an
AbstractAlertDialog to the
openDialog() method.
For example, you have an application named MyApplication and a dialog named MyAlertDialog, you might use the following:
MyApplicationControllerImpl.openDialog(new MyAlertDialog(dialogDelegate));
Note: | Only one dialog can be opened at the same time. |
A dialog closes when a user presses any button in the dialog.
You can also programmatically close a dialog by invoking the closeDialog() method, which is in the AbstractApplicationController.java in the gen.api-src.com.softwareag.mobile.runtime.toolkit package.
Related Topics