Delphi: "ShowModal" from a non-modal secondary form

We have an application with a main form and a second modeless form that can be used side by side. Our main form shows a list of configurations, and the second modeless form shows a configuration in more detail.

When we show the modal form (requested from the second non-modal form), the main form pops up in front of the second form until we close this modal form.

How can I avoid this behavior? I already tried to create this last modal form in different ways ("Applicaton.CreateForm", "TForm.Create", setting the parent), but the main form still appears.

Any ideas?

Thanks in advance!

+4
source share
1 answer

Set Application.ModalPopupMode to pmAuto

This is what the documentation says:

 TForm.PopupParent 

Sets the order for folded forms that users cannot change. If the PopupMode property is set to pmExplicit and PopupParent is nil, then Application.MainForm is implicitly used as PopupParent. If Application.MainForm is not assigned, then Application.Handle is used as PopupParent. If the PopupMode property is set to pmAuto, ScreenActiveForm is used as the PopupParent property.

+5
source

Source: https://habr.com/ru/post/1439780/


All Articles