[fpc-pascal] Assigning Interface method to event handler

Sven Barth pascaldragon at googlemail.com
Wed May 25 14:31:19 CEST 2016


Am 25.05.2016 13:54 schrieb "Graeme Geldenhuys" <
mailinglists at geldenhuys.co.uk>:
>
> On 2016-05-25 12:18, Michael Van Canneyt wrote:
> > I am not sure this is safe to do, since an event handler exists of 2
> > pointers: data and method. As far as I know, an interface does not have
a
> > data pointer.
>
> I don't fully understand your statement about 2 pointers? An event
> handler is simply a procedure of a object. When an event is triggered,
> that simply means the procedure is called and parameters are passed to it.

A "procedure of object" is in fact a TMethod record (yes that type exists)
that contains the pointer to the method as well as what is going to be
loaded as "Self" (the data part Michael mentioned), because without that
you wouldn't know which instance this method belongs to (all instances of a
class share the same code after all).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160525/a35398fb/attachment.html>


More information about the fpc-pascal mailing list