Hi, i apologize if this is in the wrong section (First Post);

i am fairly new to delphi / pascal but was wondering how to create a form within a form, e.g. click a button on Form1 to open Form2, i am aware that tform.create is a function but am not sure how to use it,
i would appreciate an answer :)

Recommended Answers

All 4 Replies

there is more than one way ....
1. When Form2 is an autocreate Form ( Delphi Application automatically creates the Form at the start ot the Application ) :
In this case it is enough to Show the Form2, without create it, because it is already created:




2. When Form2 is not an autocreate Form :
In this case firs you have to Create the Form, Show it and Destroy it after it's usage:

Application.CreateForm(TForm2, Form2);

There is a third way when the Application is Multi Document Interface: Property of the Form1 FormStyle is set as fsMDIForm, and property of the Form2 FormStyle is set as fsMDIChild, so Form2 will appears really inside the Form1

thankyou very much :)

thank you very much :)

You are welcome :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.