[Lazarus] Hook TComponent streaming system

Luiz Americo Pereira Camara luizmed at oi.com.br
Mon May 24 03:49:42 CEST 2010


Michael Van Canneyt escreveu:
> On Sat, 22 May 2010, Luiz Americo Pereira Camara wrote:
>> Mattias Gaertner escreveu:
>>> 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 ?

In fact i'd like to use an overrided Loaded in the created TForm. But it 
occurs to early:

Form := TMyForm.Create;
      [..]//Streaming system
      TMyForm.Loaded; //> occurs before the customized properties are set
MySetPropertiesFunction(Form);//Set the desired properties. Too late to 
be recognized by TMyForm.Loaded

I would need :

Form := TMyForm.Create;
      [..]//Streaming system
      //hook streaming to call MySetPropertiesFunction(Form);//Set the 
desired properties.
      TMyForm.Loaded; //> i can assume that all properties are set

By looking the TComponent/TReader code i could not figure how to do 
that, so if i did not missed something it seems is not possible.

I'll look at other solutions.

Luiz






More information about the Lazarus mailing list