Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Jonas Maebe
Michael Van Canneyt wrote on Wed, 25 May 2016: On Wed, 25 May 2016, Jonas Maebe wrote: Sven Barth wrote on Wed, 25 May 2016: An method pointer is always automatically constructed by the compiler consisting of the address of the method (here IFPReportFilter.RenderReport) and the instance tha

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Graeme Geldenhuys
On 2016-05-25 13:31, Sven Barth wrote: > that contains the pointer to the method as well as what is going to be > loaded as "Self" (the data part Michael mentioned) Thanks for explaining it Sven. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Graeme Geldenhuys
On 2016-05-25 13:32, Jonas Maebe wrote: > It works by design. Excellent, thanks for confirming that. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Michael Van Canneyt
On Wed, 25 May 2016, Jonas Maebe wrote: Sven Barth wrote on Wed, 25 May 2016: An method pointer is always automatically constructed by the compiler consisting of the address of the method (here IFPReportFilter.RenderReport) and the instance that method belongs to (in this case the FReportFi

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Jonas Maebe
Sven Barth wrote on Wed, 25 May 2016: An method pointer is always automatically constructed by the compiler consisting of the address of the method (here IFPReportFilter.RenderReport) and the instance that method belongs to (in this case the FReportFilter), so this will indeed work without prob

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Sven Barth
Am 25.05.2016 13:54 schrieb "Graeme Geldenhuys" < mailingli...@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 point

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Sven Barth
Am 25.05.2016 13:18 schrieb "Michael Van Canneyt" : > > > > On Wed, 25 May 2016, Graeme Geldenhuys wrote: > >> Hi, >> >> Can I safely assign a method from an Interface reference to an event >> handler. The code below works, but I'm not sure if it is safe to do so, >> and allowed. >> >>

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Graeme Geldenhuys
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

Re: [fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Michael Van Canneyt
On Wed, 25 May 2016, Graeme Geldenhuys wrote: Hi, Can I safely assign a method from an Interface reference to an event handler. The code below works, but I'm not sure if it is safe to do so, and allowed. == TTestApp = class(TObject) private rpt: TFPReport

[fpc-pascal] Assigning Interface method to event handler

2016-05-25 Thread Graeme Geldenhuys
Hi, Can I safely assign a method from an Interface reference to an event handler. The code below works, but I'm not sure if it is safe to do so, and allowed. == TTestApp = class(TObject) private rpt: TFPReportReport; FReportFilter: IFPReportFilter; // c