[Lazarus] the protected property TCompressionStream.OnProgress

Antônio antoniog12345 at gmail.com
Fri Jul 10 05:38:25 CEST 2009


Well, you could derive a class and publish the property.

Antônio

2009/7/10 闫程远 <yanchengyuan at gmail.com>

> Hi all!
> i wanted to compress a file using TCompressionStream, with a progressbar to
> show the progress.
> i wrote the code but they got Compilation Error:
>
> var
>   fs,ms:TMemoryStream;
>   cs:TCompressionStream;
>   size:int64;
> begin
>   fs:=TMemoryStream.Create;
>   fs.LoadFromFile(SourceFile.Text);
>   size:=fs.Size;
>
>   ms:=TMemoryStream.Create;
>   ms.Write(size,sizeof(size));
>
>   cs:=TCompressionStream.create(clMax,ms);
>   pb.Max:=Integer(size div 1024);
>   cs.onProgress:=CsOnProgress;
>   fs.SaveToStream(cs);
>   cs.Free;
>
>   ms.SaveToFile(DestFile.Text);
>   ms.Free;
>   fs.Free;
> end;
>
>
> the Error Messages are:
> UCryptForm.pas(105,6) Error: identifier idents no member "onProgress"
> UCryptForm.pas(105,30) Error: Wrong number of parameters specified for call
> to "CsOnprogress"
> UCryptForm.pas(63,22) Hint: Found declaration:
> TCryptForm.CsOnprogress(TObject);
> UCryptForm.pas(198) Fatal: There were 2 errors compiling module, stopping
>
> i searched on the web, and found this page:
> http://community.freepascal.org:10000/docs-html/fcl/zstream/tcompressionstream.onprogress.html
> in this page, the OnProgress property was declared as "public", and on my
> machine, the property is declared as "protected".
>
> Can anybody tell me why?
> Thanks in advance.
> --
> Regards,
> Yan Chengyuan
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20090710/a5e3ccdd/attachment-0004.html>


More information about the Lazarus mailing list