Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-07

csLoading

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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.

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

Graeme Geldenhuys
to Vincent Snijders

2008/7/9 Vincent Snijders :

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/

Martin Schreiber
to Vincent Snijders: This is sequel to this thread of almost two years ago:…
Vincent Snijders wrote 14 lines
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. 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

Vincent Snijders
to Martin Schreiber
Martin Schreiber wrote 17 lines
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. > > 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

Vincent Snijders
to Vincent Snijders
Vincent Snijders wrote 6 lines
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