Reputation: 474
This is the code I'm using in my main form:
if not Assigned(FPerHist) then
begin
Application.CreateForm(TFPerHist,FPerHist);
end;
FPerHist.Show;
I set FormStyle of FPerHist to StayOnTop.
This works for allowing multiple forms to be opening, while keeping all sub forms on top of the main form. But when the form is in a middle of loading something, or reached a checkpoint while debugging, the form stays on top of other applications.
Users find this annoying because they can't work on other things while this form is loading, and while debugging I can't switch to Delphi 7 window until I moved this application to another desktop (I'm using Windows 10).
Is there any other way for this to work on Delphi 7?
Upvotes: 2
Views: 1683
Reputation: 595887
This was solved in later Delphi versions by the introduction of the TForm.PopupParent
property. You would simply remove the fsStayOnTop
style, and set the MainForm as the PopupParent
of your secondary Forms.
But, PopupParent
does not exist in Delphi 7, so you will have to simulate it manually, by overriding the virtual CreateParams()
method of your secondary Forms to assign the MainForm.Handle
as the TCreateParams.WndParent
.
Upvotes: 6