The classes used in the DFM have to referenced by code (Specifically do
RegisterClasses - the compiler/linker adds this automatically ) else they
are eliminated by the linker, hence the need to declare the components as
being used in the form.

This is exactly the danger of not having the DFM match the declarations in
the .pas file.


> -----Original Message-----
> From: Aaron Scott-Boddendijk [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, August 24, 1999 3:12 PM
> To:   Multiple recipients of list delphi
> Subject:      Re: [DUG]:  Form Declarations
> 
> > 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.
> 
> There's an annoying problem with inherited forms that can arise from this
> fact.
> 
> Since it is the DFM that dictates construction rather than the pas
> contents it is possible
> for the DFM to contain a reference to a class that is not included in the
> unit and at runtime
> you get 'Class TSuchAndSuch not found' since the DPR streaming uses a
> mechanism of
> getting the TClass by name as defined in the DFM.
> 
> I forget the sequence of events to cause this but it happens...
> 
> --
> Aaron Scott-Boddendijk
> Jump Productions
> (07) 838-3371 Voice
> (07) 838-3372 Fax
> 
> 
> --------------------------------------------------------------------------
> -
>     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

Reply via email to