csLoading

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

csLoading

Vincent Snijders
Hi,

This is sequel to this thread of almost two years ago:
http://lists.freepascal.org/lists/fpc-devel/2006-September/008737.html

Some things changed (e.g. TComponent.Loading has been added), but I stil
did not find an easy way to fix lazarus bug 7305.

Looking at TReader.ReadComponent I have two questions:
First, why is for inline components csLoading set before the constructor
is called and why for other components after the constructor is called.
Having csLoading set before the constructor would help me to decide to
set the default values for the collection or not.

Secondly, why isn't TComponent.Loading called to set the csLoading flag?
That way it could have been override by component, that needs a
different state when loading than when just created. Or for what other
purposes is TComponent.Loading made virtual? IIRC Graeme just needed it
protected so he could call it.

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: csLoading

Graeme Geldenhuys-2
2008/7/9 Vincent Snijders <[hidden email]>:
> Secondly, why isn't TComponent.Loading called to set the csLoading flag?

That would make sense and be more consistent.  I think it might have
been a oversight when TComponent.Loading was implemented.

>  IIRC Graeme just needed it protected so he could call it.

Yup, that was my only request at the time. Without Loading() I
couldn't set the ComponentState field and reuse the existing csLoading
flag. I don't use the stream classes (TReader/TWriter) to construct
and setup my components in fpGUI, I use plain Object Pascal and their
properties. In my case csLoading is used to control whether events
fire or not, when properties are modified.


Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: csLoading

Martin Schreiber
In reply to this post by Vincent Snijders
On Wednesday 09 July 2008 23.24:31 Vincent Snijders wrote:

> Hi,
>
> This is sequel to this thread of almost two years ago:
> http://lists.freepascal.org/lists/fpc-devel/2006-September/008737.html
>
> Some things changed (e.g. TComponent.Loading has been added), but I stil
> did not find an easy way to fix lazarus bug 7305.
>
> Looking at TReader.ReadComponent I have two questions:
> First, why is for inline components csLoading set before the constructor
> is called and why for other components after the constructor is called.
> Having csLoading set before the constructor would help me to decide to
> set the default values for the collection or not.
>
You could check csLoading of the AOwner parameter.

Martin
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: csLoading

Vincent Snijders
Martin Schreiber schreef:

> On Wednesday 09 July 2008 23.24:31 Vincent Snijders wrote:
>> Hi,
>>
>> This is sequel to this thread of almost two years ago:
>> http://lists.freepascal.org/lists/fpc-devel/2006-September/008737.html
>>
>> Some things changed (e.g. TComponent.Loading has been added), but I stil
>> did not find an easy way to fix lazarus bug 7305.
>>
>> Looking at TReader.ReadComponent I have two questions:
>> First, why is for inline components csLoading set before the constructor
>> is called and why for other components after the constructor is called.
>> Having csLoading set before the constructor would help me to decide to
>> set the default values for the collection or not.
>>
> You could check csLoading of the AOwner parameter.
>

Thanks. That is a good suggestion. I'll use it if nothing better comes up.

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: csLoading

Vincent Snijders
Vincent Snijders schreef:
> Martin Schreiber schreef:
>> You could check csLoading of the AOwner parameter.
>>
>
> Thanks. That is a good suggestion. I'll use it if nothing better comes up.
>

This was simple enough. I used it in r15730 of Lazarus. Thanks.

Vincent
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal