[fpc-devel] Recent added support for Observer pattern in FCL
Luiz Americo Pereira Camara
luizmed at oi.com.br
Tue Aug 28 18:31:47 CEST 2012
Em 28/8/2012 12:46, michael.vancanneyt at wisa.be escreveu:
> On Tue, 28 Aug 2012, Luiz Americo Pereira Camara wrote:
>> Em 28/8/2012 09:15, michael.vancanneyt at wisa.be escreveu:
>>> On Tue, 28 Aug 2012, Luiz Americo Pereira Camara wrote:
>>>> Why not let TFPObservedOperation as integer and define constants.
>>>> It could define a constant like ooUser = 32
>>>> Below ooUser is reserved for future default constants
>>>> Above ooUser could be added custom messages
>>>> This is how LCL messages works
>>> Exactly because it is not meant as a general messaging interface,
>>> and I want the interface to reflect this.
>>> There is a clear intended use case: Mainly notification of changes.
>> This is the purpose i intend to use (replace my implementation).
>> Basically is a tree structure that needs to be observed. To avoid
>> performance problems like having to parse all the tree when a change
>> occurs i defined actions when a Child is added, deleted or inserted.
> Exactly. You should use ooAddItem, ooDeleteItem, and pass the treenode
> in Data.
>> To be clear what i would need to do with the current approach:
> Your example is not correct. I don't see why you would not use
This was just the first thing that comes in mind.
I have a simple interface to observing a tree. Looking more carefully i
really can use ooItem* for children. I also defined a "Change"
notification for the object itself plus another for the child/item but
i could differentiate using data as nil. The other missing one is to
Load (lazy loading)
> We can agree on the exact number of operations that we define, but I will
> not implement a system with an open number of operations.
I will do some tests and inform if there's a generic enough case to be
included as a default notification
Thanks for the explanations
More information about the fpc-devel