Reputation: 331
I am using main form and child forms.
If I open 2nd child form with
TMYForm.Create(nil);
It does not stack it on the 1st child form top.
Is there any way for 2nd and X'th child form to appear in exact same position as 1st child form?
Or I need to destroy old child form while creating new one (as stacking is done automatically)?
Upvotes: 0
Views: 412
Reputation: 5975
If you have references to the child forms, use Form2.BoundsRect := Form1.BoundsRect
Upvotes: 0
Reputation: 21650
That is the expected behavior. Without specifying otherwise, Forms will open on the right and down from the position of the previously opened.
If you want to control the position of your form, change its Position
property to poDesigned
, but you have to set its Top
and Left
properties to ensure it'll be visible.
Or you can used some presets: poDesktopCenter, poMainFormCenter, poOwnerFormCenter
or poScreenCenter
.
Upvotes: 4
Reputation: 16
Try putting this:
TMYForm.Position:=poMainFormCenter;
or
TMYForm.Position:=poOwnerFormCenter;
Before TMYForm.Create(nil);
-S
Upvotes: 0