[lazarus] How are we going to store component data?
michael at tfdec1.fys.kuleuven.ac.be
michael at tfdec1.fys.kuleuven.ac.be
Wed Jul 21 12:43:38 EDT 1999
On Wed, 21 Jul 1999, Michael A. Hess wrote:
> I know this is getting a little ahead of where we are in development but
> I have been looking over the issue trying to figure out the best way to
> do this. In Delphi the .dfm data is stored by the compiler in the
> resource area of the executable. Then when a form is loaded the various
> form specs. and attached components are read out of the resource data
> and instances generated.
>
> How are we going to do this with Free Pascal and the FCL???
>
> Are we going to use a resource mechanism? Will the RAD part of the IDE
> create a .dfm type file. I believe this would require compiler support.
> Is there plans for a type of resource area with Free Pascal built
> programs?
For strings this has been designed (resourcestring section); for other
resources not yet. We are open to suggestions.
>
> Or are we going to have the RAD generate FCL code that is included into
> the file via an {$I ...} statement at the appropriate place?
This is a possibility which you can consider, and which would be very fast;
you could make a TForm abstract method called :
TForm.CreateDesignedForm;virtual;
begin
end;
Which you override in the .dfm form:
TForm.CreateDesignedForm; override;
begin
SetBounds(X,Y,W,H); // place form
MyButton:=Tbutton.Create(Self);
// and so on
end;
At the end of TForm.Create you then do a
CreateDesignedForm;
If Assigned(OnCreateForm) do
OnCreateForm(Self);
// Form Creation Complete.
end;
>
> I ask because I am planning on doing some experimenting with this. We
> don't have the RAD yet to generate the file but I want to start the
> design and layout of what the RAD needs to do.
This will be primarily determined by the route you take: using resources
or generating a creation procedure; I think that first you must decide
which way you want to use.
Michael.
More information about the Lazarus
mailing list