Form inside MainForm

My application consists of one main form and couple of other forms. I am wondering if it is possible to keep all forms created inside the client area of the main form so that if I minimize or move the main form, all other opened form will still be kept inside the main form's client area.

Any idea will be appreciated !

Raymond
chan3898Asked:
Who is Participating?
 
MatveyConnect With a Mentor Commented:
Of course! Just make the other forms' parent the main form. I already tried this - what you get is simply windows drawn inside the main window, with tha ability to drag and close, and you can operate on it like any other window. Hope this is better for you than an MDI application...

--Matvey
0
 
kretzschmarCommented:
hi chan3898,

make a mdi-application. See delphi examples.

meikl
0
 
chan3898Author Commented:
Is there other possible way beside using MDI-application.
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
AleqCommented:
Only hook a wm_move message a move windows when the main one has been moved....
0
 
MatveyCommented:
BTW, this way you can make your form to be a parent even for a window from a different application, the Windows Explorer for example, or anything else, using the SetParent API.
0
 
chan3898Author Commented:
I have tested your suggestion by making a new application with two forms (Form1 and Form2).  Form2 will be created using the following statement :
   Form2 := TForm2.create(Self);   // inside Form1's

However, Form2 doesn't move when I move Form1 around the screen.

Any more suggestion ?

Thank you !
0
 
kretzschmarCommented:
hi chan3898,

try this

procedure TForm1.FormCreate(Sender: TObject);
begin
  Form2 := TForm2.Create(Self);
  Form2.Parent := Form1;
  Form2.show;
end;

meikl
0
 
chan3898Author Commented:
Thank you, I have got what I want.
0
 
chan3898Author Commented:
Thank you, I have got what I want.
0
All Courses

From novice to tech pro — start learning today.