[Lazarus] the protected property TCompressionStream.OnProgress

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jul 10 07:23:20 CEST 2009


On Fri, 10 Jul 2009 12:38:09 +0800
闫程远 <yanchengyuan at gmail.com> wrote:

> well, that worked. thanks.
> but there's still a problem:
> when i tried to assign a method to the OnProgress property, i got a
> error message:
> 
> UCryptForm.pas(100,37) Error: Wrong number of parameters specified
> for call to "CsOnprogress"
> UCryptForm.pas(59,22) Hint: Found declaration:
> TCryptForm.CsOnprogress(TObject);
> UCryptForm.pas(193, stopping
> 
> 
> the method was declared and implemented as follow:
> 
>   TCryptForm = class(TForm)
>     //... other declarations
>     procedure CsOnprogress(Sender:TObject);
>   private
>     { Private declarations }
>   public
>     { Public declarations }
>   end;
> 
> procedure TCryptForm.CsOnProgress(Sender:TObject);
> begin
>   pb.Position:=Integer(TCompressionStream(Sender).Position div 1024);
>   Application.ProcessMessages;
> end;
> 
> and i assigned the method in this way:
> cs.onProgress:=Self.CsOnprogress;
> 
> why does this get CE?

I mode objfpc you must assign the address to the procedure:

cs.onProgress:=@Self.CsOnprogress;


>[...lots of old rubbish...] 


Mattias




More information about the Lazarus mailing list