in GUI Development by


I wonder how I could use DismissDialog() to close all dialogs open in the application. Currently, I have implemented a menu with nested dialogs, where a new dialog is shown by means of PresentDialog() above the previous one. I would like to implement a slot that allows to close all these menu dialogs (the shown one and the hidden ones) at once when the proper KeyHandler.Filter is true. I guess I should use DismissDialog() individually for each dialog in the "menu tree", but I have not been able to find the proper way to do it.

I have had a look on the next example of "Managing dialogs (multiple screens)" documentation (https://doc.embedded-wizard.de/data/9.00/managing-dialogs-5.zip), but I cannot apply this way of working to my application -although I tried-, since I use several instances of different menu types of my creation (i.e. SCREENS::Menu and SCREENS::MenuPicker) along the menu tree, as you can see in the image below. In the start of the Application, I implement a new object of SCREENS::MenuSettings class to open the main menu and the rest of submenus are open from it according to selected item.

Any other idea?

Thanks in advance for your help and regards,


1 Answer

+1 vote
Best answer

Hello Fayna,

I guess I should use DismissDialog() individually for each dialog in the "menu tree", but I have not been able to find the proper way to do it.

yes, this the right approach. The challenge here is to find all actually (or all desired) dialogs and dismiss them. You would implement for this purpose usually a loop. See the section Enumerate and search for existing Dialogs. It explains how to find dialogs existing actually within a group and it also demonstrates how to dismiss them. According to the description found there you could implement following code. It searches for all actually existing dialogs (therefore the search operation starts in the root object):

var Core::Root  theRoot = GetRoot();
var Core::Group dialog  = theRoot.FindCurrentDialog();

while ( dialog )
  dialog.Owner.DismissDialog( dialog, null, null, null, null, null, false );
  dialog = theRoot.FindCurrentDialog(); 

Important aspect: if your dialogs are using animations (transitions) to dismiss them, you can pass in the last parameter of the DismissDialog() method the value true for the second and all following dialogs. Then the dismiss animations are not performed one after another but simultaneously - all dialogs e.g. fade-out at the same time. If it is interesting you see the section Perform several Dialog transitions simultaneously.

Best regards

Paul Banach

Hi Paul,

Thank you for your feedback. Closing all dialogs at once works as expected now, and I have taken into account your comment related to simultaneous transitions.



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