in Embedded Wizard Studio by
Hi Team,

We are trying to implement a case where we need to switch between screens depending on certain condition. For eg: if I am at screen A and a certain condition becomes TRUE, I move to screen B. Similarly in screen B we have a slot to check if we must move to screen A. What is the best way to achieve this? Each time we perform SwitchToDialog, it is overlaying these screens I believe. Should we use Present and Dismiss Dialog instead? (Both screens are not pop us. They are proper full sized screens). Please suggest.

Thank you!

1 Answer

0 votes

Hello Anand,

use SwitchToDialog(). It automatically replaces the actual dialog with a new one.

Each time we perform SwitchToDialog, it is overlaying these screens I believe.

It can occur when you invoke SwitchToDialog() in context of different GUI components. For example:

1. First you invoked SwitchToDialog( A, ... ) in context of the Application component.

2. Then being in A you invoked SwitchToDialog( B, ... ). This invocation is thus performed in context of the A component. The component B appears thus embedded inside A.

3. Later when you perform SwitchToDialog( A, ... ) in context of the component B, a new component A is presented inside component B.

As consequence, all components appear nested one inside the other. How to solve the issue?

You have to take in account the right context in which you perform the SwitchToDialog() operation. If you want to switch from dialog A to dialog B, then you have to perform SwitchToDialog( B, ... ) in context of the component, the dialog A belongs to. The simplest approach to achieve this is the usage of the Owner variable:

if ( IsCurrentDialog())
  Owner.SwitchToDialog( new Unit::DialogB, ... );

Please note the usage of IsCurrentDialog() to avoid race conditions.

Does it help you further?

Best regards

Paul Banach

Thanks for your response! It works

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint