[Lazarus] Setting events - Bug?

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Oct 2 19:16:21 CEST 2009


On Fri, 2 Oct 2009 14:11:00 -0300
Guionardo Furlan <guionardo at gmail.com> wrote:

> Hello, this is the situation (lazarus 0.9.29 - fpc 2.3.1):
> TMyClass = class
>   private
>     FNotifica: TNotifyEvent;
>       procedure SetNotifica(const AValue: TNotifyEvent);
> published
>   property Notifica: TNotifyEvent read FNotifica write SetNotifica;
> end;
> 
> var MyClass: TMyClass;
> 
> This is OK.
> 
> On another unit, I have:
> 
> TAnotherClass = class
> public
>   procedure DoNotifica(Sender: TObject);
>   procedure SetLinks;
> end;
> 
> procedure TAnotherClass.SetLinks;
> begin
>   MyClass.Notifica:=self.DoNotifica; // <--- This is the problem

 MyClass.Notifica:=@DoNotifica; // <--- This is the solution


> end;
> 
> and, when fpc compile this I get:
> 
> fopessoas.pp(41,39) Error: Wrong number of parameters specified for
> call to "NotificaInfo"
> fopessoas.pp(22,15) Hint: Found declaration:
> TfPessoas.NotificaInfo(TObject);
> fopessoas.pp(91) Fatal: There were 1 errors compiling module, stopping
> 
> Well, what can I do?
 

Mattias




More information about the Lazarus mailing list