tags:

views:

141

answers:

3

I have a couple of other forms floating around the MainForm

  for I := 1 to UserCount then
    tempform:= TCustomFrm.Create(self);

and I want them to be dependent on the MainForm, meaning when I minimize the MainForm they're also minimized, and then I maximize the MainForm the other forms are also maximized.

I also want them to be positioned within the MainForm, though I do think I can already do that. Is there a way to do that?

+3  A: 

It seems from your explanation that you are looking for an MDI type of application ( Multiple Document Interface )

Take a look at these tutorials :

http://delphi.about.com/od/objectpascalide/l/aa042500a.htm

http://www.delphigeist.com/2009/10/mdi-application-tutorial.html

regards

GX
+1  A: 

It almost sounds like you don't want multiple forms at all. Rather, you want multiple frames. Design each TFrame as you would a form, and then place them all on your main form with Align := alClient. That property will ensure that the frames remain the same size as the form. Since they're child controls of the form, they'll disappear when you minimize the form. Keep only one frame visible at a time (or else you'll be able to use the Tab key to navigate to controls that can't really be seen).

If you want the children to be a different size from that of the main form, and you want to be able to drag the children to new positions within the bounds of the main form, then you want MDI.

Rob Kennedy
+1  A: 

The other thing you can do is trap when the MainForm is minimized and then loop through the MainForm.Components array to find the child forms and minimize the child forms as well.

You can do the same thing with maximizing.

Dave Novo