[Lazarus] TFiler.DefineBinaryProperty ReadData size problem

Mattias Gaertner nc-gaertnma at netcologne.de
Tue May 20 12:11:54 CEST 2008


On Tue, 20 May 2008 16:34:50 +0800 (CST)
brianwung at seed.net.tw wrote:

> On Tue, 20 May 2008 14:26:53 +0800 (CST) brianwung at seed.net.tw wrote:
> 
> > Dear All,
> > 
> > procedure TspCompressedStoredSkin.DefineProperties(Filer: TFiler); 
> > begin
> >   inherited;
> >   Filer.DefineBinaryProperty('CompressedData', ReadData, WriteData, 
> > True); end;
> > 
> > procedure TspCompressedStoredSkin.ReadData; begin
> >   FCompressedStream.LoadFromStream(Reader);
> > end;   
> 
> >>What is FCompressedStream?
> >>ReadData is missing the parameter.
> 
> FCompressedStream IS TMemoryStream.

Something like that:

procedure TspCompressedStoredSkin.ReadData(Reader: TStream); 
begin
  FCompressedStream.Position:=0;
  FCompressedStream.LoadFromStream(Reader);
  ...
end;   

?
This should work the same as Delphi.

> > On Delphi, this method returns rigth size(38750 byte) and it's work.
> > but on Lazarus returns wrong size(38764 byte).
> > Why? Is it a bug?

>From what kind of stream are you reading? .lfm, .xml? Under what
platform and which fpc version?
Can you post a more complete example?

Mattias




More information about the Lazarus mailing list