[fpc-devel] Recent added support for Observer pattern in FCL

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Aug 28 16:37:09 CEST 2012



On Tue, 28 Aug 2012, Graeme Geldenhuys wrote:

> On 28/08/12 13:15, michael.vancanneyt at wisa.be wrote:
>> 
>> For example, on my 'doubtful' list I had "ooPropertyChange", to be used
>> in combination with the GetPropInfo() and a call in TPersistent:
>> 
>> FPOPropertyChanged(Const APropName : String);
>
>
> This could work, and I can see use-cases where this could be useful. I'm not 
> sure how much overhead it will add though, but probably very small if done 
> correctly. How would streaming affect this? eg: populating objects from a 
> .lfm file. I don't use such streaming, but thought I need to mention it. For 
> more accurate information, I guess the best would be to do a reference 
> implementation, create a test case, and decide from there.

Well, I can add the call, but I would not call it automatically.
It is up to the implementor of a class to call the FPOPropertyChanged from
a setter.

I imagine that this could be protected with a

if not (csLoading in ComponentState) then
   FPOPropertyChanged(APropName);

Michael.



More information about the fpc-devel mailing list