Open Form2 side by side with Form1 simultaneously and close or minimize both simultaneously

Asked

Viewed 1,222 times

7

I need to open 2 forms simultaneously next to each other and then when I close or minimize any of them, the 2 be closed/minimized simultaneously. I looked for some idea on several sites and all I found so far was the following code that shows the "Form2" in the bottom right corner of the screen.

Follow the code below:

// Form 1

procedure TForm1.Button1Click(Sender: TObject);
begin
Form2.show;
end;


// Form 2

procedure TForm2.FormShow(Sender: TObject);
begin
Form2.TOP:= SCREEN.WorkAreaHeight - Form2.HEIGHT;
Form2.LEFT:=SCREEN.WorkareaWidth - Form2.WIDTH;
end;

Does anyone have any idea how to achieve this goal?

3 answers

1

Friend, use the component Jvformmagnet he does this job, for you, basically you put one in each form, arrow the property "Formmagnet" to true, and in the second form you arrow "Mainformmagnet" to true tb. do some tests and see the magic!

0

Perhaps a new approach will be more efficient.

1 - You have the 1 screen called Form1

2 - You have the 2 screen called form2

3 - Create a third screen with 2 panels, each with the dimensions of Form1 and form2

4 - In the formshow of this screen (form3), Make a create in Form1 by placing the Parent for Panel1. Then create in form2 by placing Parent to panel2.

Forms will be created within each panel.

I hope it helps.

0

  • I wanted via using form even. Msm so thanks for the tip!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.