Jump to content
Ian Branch

Main Form jumping into view..

Recommended Posts

Hi Team,

I'm sure this is something I should know. ;-)

If I call a Form off the Main Form via a ToolBar Button using say "TSecondForm.Create(nil).Show;", it appears over the Main Form.  Good.

From time to time the Main Form will re-appear between the SecondForm and say a dialog.

I need the Second, Third, etc, forms to be non-modal so that more than one of them can be open(ed).

I have a work around by when the Second, Third, etc form is called/created it calls Application.Minimize.  Messy.

Is there a better way to manage this issue?

 

Regards & TIA,

Ian

Share this post


Link to post

Maybe related...?

I'd also experiment with .BringToFront and .RestoreTopMosts but I'm almost certain that this will push it behind a modal dialog. Keep in mind that this is by design though - if there's an open modal dialog behind your visible form, no actions will be processed and your program will seem to be frozen!

 

If you really need to achieve this, you could make your own dialog as a simple form and handle the .Enabled and .Visible properties from code. It might sound messy, but results will always be more reliable than playing around with owner and poup handles imo.

 

Share this post


Link to post

With these issues you need to understand the hierarchy of your windows' owner relationships. The term owner is the winapi term. In VCL terms it is popup parent, not to be confused with VCL owner. Start by making a minimal reproduction and try to understand that window owner hierarchy. Read the MSDN docs on window features to understand the impact of window owner. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×