[Lazarus] A simple event problem in console program

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Dec 15 23:09:49 CET 2015


On Tue, 15 Dec 2015 14:02:48 -0800
Aradeonas <aradeonas at operamail.com> wrote:

>[...]
> 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;

Because
TNotifyEvent = procedure(Sender: TObject) of object;

The 'of object' means you need a method, not a procedure.


> > project1.lpr(30,13) Error: Incompatible types: got "<address of
> > procedure(TObject);Register>" expected "<procedure variable type of
> > procedure(TObject) of object;Register>"


Mattias




More information about the Lazarus mailing list