Re: [fpc-pascal] question with interfaces, hooks

2015-07-16 Thread Graeme Geldenhuys
On 2015-07-15 19:58, David Emerson wrote: > Any example code that shows the power of interfaces or > TAggregatedObject in a somewhat useful example? The best Interfaces usage I've ever seen was done by Joanna Carter with her MVP implementation. The articles and source code is available on my serv

Re: [fpc-pascal] question with interfaces, hooks

2015-07-16 Thread David Emerson
Thanks, Graeme and Sven! On 07/14/2015 11:05 PM, Sven Barth wrote: Not related to your problem, but important nevertheless: you don't need to free interface variables. They are reference counted and freed automatically at least if you don't mix a class reference (in your case to t_foo_base) and

Re: [fpc-pascal] question with interfaces, hooks

2015-07-15 Thread Sven Barth
Am 15.07.2015 11:51 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2015-07-15 10:21, Sven Barth wrote: > > The property could even be > > protected or private and it should still work as long as the containing > > class has the interface in its parent list. > > I thought that

Re: [fpc-pascal] question with interfaces, hooks

2015-07-15 Thread Graeme Geldenhuys
On 2015-07-15 10:21, Sven Barth wrote: > The property could even be > protected or private and it should still work as long as the containing > class has the interface in its parent list. I thought that would only work if you access the method via an interface variable, not a class instance variab

Re: [fpc-pascal] question with interfaces, hooks

2015-07-15 Thread Sven Barth
Am 15.07.2015 09:27 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2015-07-15 05:06, David Emerson wrote: > > So... since t_fancy_class implements the interface i_foo, why is > > t_fancy_class.foo not available? > > Because you told it a property named "hook" implements it, so

Re: [fpc-pascal] question with interfaces, hooks

2015-07-15 Thread Graeme Geldenhuys
On 2015-07-15 05:06, David Emerson wrote: > So... since t_fancy_class implements the interface i_foo, why is > t_fancy_class.foo not available? Because you told it a property named "hook" implements it, so you need to call it as follows: fc.hook.foo; Regards, - Graeme - -- fpGUI Toolkit

Re: [fpc-pascal] question with interfaces, hooks

2015-07-14 Thread Sven Barth
Am 15.07.2015 06:07 schrieb "David Emerson" : [snip] > constructor t_fancy_class.create; > begin > inherited; > f_hook := t_foo_base.create; > end; > > destructor t_fancy_class.destroy; > begin > t_foo_base(f_hook).free; > inherited; > end; [snip] Not related to your proble