[fpc-pascal] IFPObserved

Michael Van Canneyt michael at freepascal.org
Wed Sep 11 10:11:10 CEST 2013



On Wed, 11 Sep 2013, Xiangrong Fang wrote:

> Hi Michael,
>
>             3) What are "Live Binding"?  What's the difference between "IFPObserved" and the component events like OnCreate, OnShow, OnClick...?
> 
> 
> See IFPObserved as a general event mechanism. 
> 
>  
>       The main difference is that a component can have only 1 OnCreate handler.
>       whereas, in theory, an unlimited number of observers can observe one object.
> 
> 
> OK, then who defines "changed"?  i.e. if I hook an event handler by using a TComponent's FPOAttachObserver method, WHEN will my code gets called?

That depends entirely on the implementation of the component and needs to be documented.
The implementor of the component needs to decide when to call this.

For instance, for TStrings, this is called whenever the list changes

For TList, this is called when items are added/deleted etc.

Michael.


More information about the fpc-pascal mailing list