[Lazarus] Hook TComponent streaming system

Michael Van Canneyt michael at freepascal.org
Sun May 23 11:06:50 CEST 2010



On Sat, 22 May 2010, Luiz Americo Pereira Camara wrote:

> Mattias Gaertner escreveu:
>> On Sat, 22 May 2010 18:33:47 -0300
>> Luiz Americo Pereira Camara <luizmed at oi.com.br> wrote:
>>
>> 
>>> 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?
>
> Just for convenience.
>
> Currently i'm sending a custom message to notify the form that all properties 
> (stored in lfm plus customized) are initialized so it can take the necessary 
> actions:
>
> Form.Perform(CM_INIT, 0, 0);
>
> If i find such event/procedure i could get rid of the message 
> sending/receiving.
>
> Not a big issue. I still can use OnShow, CreateWnd but it would not be as 
> intuitive as using Loaded.

What is wrong with overriding Loaded ? It is the last thing that is called ?

Michael.




More information about the Lazarus mailing list