360 views
in GUI Development by
Hi,
1) I have a process where I show a specific screen to do a measurement. When an EventReady is published, i go automatically to the next screen using a SwitchToDialog() function. This works great

2) When the power button is pressed a RequestShutdownEvent is published, i want to show an Alert Dialog "Do you really want to shutdown (Yes/No)" (using PresentDialog()). When the user presses "No" I want to go back to the underlying screen using DismissDialog().

When I have the next situation

- I am in the measurement (MeasurementScreen is shown)

- A RequestShutdownEvent is published (ShutdownScreen is shown on top of the MeasurementScreen)

- A EventReady is published (hidden MeasurementScreen switches to hidden MeasurementReadyScreen)

- The user presses Cancel (DismissDialog on ShutdownScreen)

- The MeasurementReadyScreen should be showed now

1 Answer

0 votes
by

Hello Karijn Wessing,

to achieve this functionality you will need to manage two separate dialog stacks.

In most usual application cases, the dialogs are presented in context of the Application component (in context of the root object). The dialogs build so a single dialog stack. When a new dialog is presented, the preceding dialog is overlaid by it. When the user dismisses the dialog the previous dialog on the stack is exposed again.

The simplest solution could be to present MeasurementReadyScreen in context of MeasurementScreen. When ShutdownScreen is presented it overlaps MeasurementScreen. If during this time a MeasurementReadyScreen is presented, this dialog appears then inside MeasurementScreen. When the user dismisses the ShutdownScreen, the underlying  MeasurementScreen with its nested MeasurementReadyScreen is exposed again.

This approach may have a disadvantage: when a dialog is presented inside another dialog, the superior dialog can still react to user inputs. It means, while MeasurementReadyScreen is visible, the user could eventually reach and activate buttons, etc. inside the superior MeasurementScreen dialog. Also, the area of the superior dialog limits the visibility of the nested dialog. It means, when MeasurementReadyScreen is larger than MeasurementScreen dialog, it will not appear completely on the screen.

To overcome the mentioned restrictions, the following, more complex approach can be used:

1. Add a new component to your project. Name it e.g. MeasurementScreenGroup.

2. Adjust the size of the MeasurementScreenGroup to correspond to the display size (to the size of the Application component).

3. At the initialisation time of the Application component present MeasurementScreenGroup as a dialog. One approach to achieve this is to implement the PresentDialog() invocation inside the Init method of the Application component.

4. The MeasurementScreen and MeasurementReadyScreen dialogs should be presented inside (in context of) the MeasurementScreenGroup component.

5. The ShutdownScreen should be presented in context of the Application component.

I hope it helps you further. See also Take a closer look at the Dialog functionality.

Best regards

Paul Banach

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...