4
votes

We have an application with a main form and a second non-modal form which can be used side by side. Our main form shows a list of configurations, while the second non-modal form shows a configuration in more detail.

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

How can I avoid this behaviour? I already tried creating that last modal form in different ways ('Applicaton.CreateForm', 'TForm.Create', setting the parent), but still get the main form to pop up.

Any ideas?

Thanks in advance!

1
How are you usually create your modal form (without using Applicaton.CreateForm) ? Have you tried something like ModalForm := TModalForm.Create(nil); ModalForm.ShowModal; ?TLama
setting the parent for modal form is risking to freeze your applicationArioch 'The
did you try setting mainform as form2nd.parent ?Arioch 'The
PopupParent might be the answer to your question.iMan Biglari
+1, I can reproduce thiswhosrdaddy

1 Answers

5
votes

Set Application.ModalPopupMode to pmAuto

This is what the documentation says:

TForm.PopupParent

Sets an order for stacked forms that users cannot change. If the PopupMode property is set to pmExplicit and PopupParent is nil, then the Application.MainForm is implicitly used as the PopupParent. If no Application.MainForm is assigned, then Application.Handle is used as the PopupParent. If the PopupMode property is set to pmAuto, Screen.ActiveForm is used as the PopupParent property.