[Lazarus] A simple event problem in console program

Aradeonas aradeonas at operamail.com
Tue Dec 15 23:02:48 CET 2015


Hi,

Maybe Im tierd but could any one tell me what this code wont work:
> program Project1;
>
> {$mode objfpc}{$H+}
>
> uses  Classes,  SysUtils;
>
> type
>
> { Tbook }
>
> Tbook = class  private    fnoti: TNotifyEvent;  public    property
> noti: TNotifyEvent read fnoti write fnoti;  end;
>
> var  b: Tbook;
>
> procedure notievent(Sender: TObject);  begin    WriteLn('test');  end;
>
> begin  b := Tbook.Create;  b.noti := @notievent; //ERROR       b.Free;
>
and give this error:
> project1.lpr(30,13) Error: Incompatible types: got "<address of
> procedure(TObject);Register>" expected "<procedure variable type of
> procedure(TObject) of object;Register>"

Regards, Ara

-- 
http://www.fastmail.com - Or how I learned to stop worrying and
                          love email again

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151215/a2d436ef/attachment-0002.html>


More information about the Lazarus mailing list