The only components created automatically are those in the form file, as
built by the IDE.
Yes by default the IDE adds the declarations to the section straight after
the " = Class( TForm )" piece.
Adding a declaration in here manually can be done, but does not necessarily
cause it to be created - when you save your form, the IDE will probably say
there is no matching component in the Form file and ask if you want to
remove it or keep it.
Myles.
> -----Original Message-----
> From: Dennis Chuah [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, August 24, 1999 2:37 PM
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Form Declarations
>
>
> Patrick,
>
> > The ones that Delphi creates for us look like
> >
> > type X = class(TForm)
> > A
> > B
> > C etc
> > public
> > ...
> > private
> > ...
> > end;
> >
> > According to the Help the first part (before public) is
> > reserved for the
> > form designer. There seems to be a bit more to it than that:
> > any object that
> > is put in here will be created automatically whereas any
> > object declared
> > under public, private or whatever has to be explicitly created by the
> > programmer in code. Is that the case?
>
> This should go into an FAQ, if there is one...
>
> Anyway, the section in question will generate class members who are either
> public or published. This depends on a compiler switch. The catch is if
> a
> class has that switched to published, all of its descendants will
> "inherit"
> that behaviour. By default TPersistent, has that switch to published -
> this
> makes most classes in Delphi behave this way.
>
> Now, to answer your question, the answer is maybe. In the case of a form,
> the IDE "drops" the declarations for all components owned by the form into
> that section. When the form is created, the constructor calls
> InitInheritedComponent (I think) which will initialise all components in
> the
> inheritance tree. It does this by first reading the DFM file from a
> resource of the same name stored in the module (you can see a text version
> of this resource when you click ALT+12 when the focus is on a form in the
> IDE). The resource specifies the properties of the form, plus all owned
> components to create (and their properties as well). The owned components
> must first be registered by a call to RegisterClass. Because the
> components
> are owned, you do not to free them explicitly - the destructor of your
> form
> does that for you. Actually, you don't need a form to take advantage of
> this. Any TComponent descended will do. Hope this answers your question.
>
> Regards,
> Dennis.
>
>
>
> --------------------------------------------------------------------------
> -
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz