Jump to content
Sign in to follow this  
Freeeee

can a single unit have more than 1 form?

Recommended Posts

type
  TForm1 = class(TForm)

   TForm2 = class(TForm)

.......

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

   Form2:TForm2;

 

doesn't work BUT if you put the Type and Var statements + an 'end'  under "private'"  or "public"  it does compile.

 

Share this post


Link to post

It is not possible if you want to design the forms. The IDE will show only the visual design for one form. 1 pas + 1 dfm is the limit.

 

You can have multiple forms with the limitation that you create the components on the form in the code.

Share this post


Link to post

thanks.  I was coming to that conclusion.  

having a IDE designed around a forms design screen without allowing multiple forms seems like a bad idea.

I programmed in Turbo pascal on DOS and Win3 years ago and Delphi seemed to be a better product then.

much easier to use.

Am I correct in that that the 2nd and other forms have to go into either the public or private sections?

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×