[Lazarus] Hook TComponent streaming system
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun May 23 00:02:00 CEST 2010
On Sat, 22 May 2010 18:33:47 -0300
Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:
> Michael Van Canneyt escreveu:
> >
> >
> > On Sat, 22 May 2010, Luiz Americo Pereira Camara wrote:
> >
> >> I'd like to set some properties of a TComponent(TForm) through RTTI
> >> before TComponent.Loaded is called.
> >>
> >> After a call to TMyForm.Create, the component is initiated through
> >> the streaming system that calls Loaded.
> >>
> >> Is there a way to hook this streaming system so i can change the
> >> properties before the call to Loaded?
> >
> > You can use defineproperties for that. You can simply override it in
> > your
> > form and set whatever properties you want. An alternative is overriding
> > 'Loading', which is called at the start.
>
> Thanks. But i think that won't help me. I'm creating a instance of a
> generic TForm (see code below) and than setting the properties after the
> call to constructor.
>
> I would need that the properties be set after loading the stored
> properties and before FormClass.Loaded is called but it's to late.
>
> The problem is that Loaded is called inside the constructor call chain.
> I could create the instance through NewInstance but AFAIK that is too
> early (before creating the stored/published properties).
>
> var
> Form: TForm;
> begin
> //FormClass: TFormClass
> Form := FormClass.Create(Owner);
> SetObjectProperties(Form, FormProperties);
> [..]
> end;
What do you want to achieve?
Why do you think you have to set a property after loading and before
Loaded?
Mattias
More information about the Lazarus
mailing list