Jump to content
Henry Olive

Form Activate

Recommended Posts

Good Day,

 

VCL

In Form1 my button code = Form2.Show;

and Form2 opens front,  but when i click the Form1(which is behind the Form2)   

Form2 should move behind of Form1  but No, like my button code was Form2.ShowModal , what am doing wrong ?

 

Thank You

 

 

Share this post


Link to post
9 hours ago, Henry Olive said:

when i click the Form1(which is behind the Form2)   

Form2 should move behind of Form1  but No, like my button code was Form2.ShowModal , what am doing wrong ?

You are not doing anything wrong.  By default, Form1 is simply becoming the parent window (in API terms, not VCL terms) for Form2, which is why Form2 can't move behind Form1. You can change this behavior by either:

  • using Form2's PopupMode and PopupParent properties
  • overriding Form2's virtual CreateParams() method to set TCreateParams.WndParent to either 0 or TApplication.Handle
  • turning off TApplication.MainFormOnTaskBar, which has the (side) effect of making the TApplication window be the parent window for all Forms.
Edited by Remy Lebeau

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

×