I get the compiler-error :
TPicturStreamItem needs finalization not - allowed in filetype.
What does this mean ?
It happens when I try to declare a file of .. type see code below:
procedure TPictureFilemanager.SaveToFile(FileName:string);
var
Entry : TPictureStreamItem;
PEntry : PPictureStreamItem;
x:integer;
SaveFile : file of TPictureStreamItem;//Here does the error occurs.
begin
if FileExists(FileName) then
begin
AssignFile(SaveFile,FileName);
Rewrite(SaveFile);
for x:=0 to PictureStreamEntrys.Count -1 do
begin
PEntry := PictureStreamEntrys.Items[x];
Entry := PEntry^;
Write(SaveFile,Entry);
end;
CloseFile(SaveFile);
end
else
begin
FErrormsg.Add('Cant find file: '+FileName);
end;
The procedure is part of the class TPictureFilemanager.
The type TPictureStreamItem;is declared in the same type-section like the class TPictureFilemanager
type
TPictureStreamItem = record
Filename : string;
Marked : boolean;
Transparent : boolean;
FileSize : integer;
Filetype : integer;
Time : integer;
end;
PPictureStreamItem = ^TPictureStreamItem;
TPictureFilemanager = class(TComponent)
private...
In a working example in the "Delphi Kochbuch" Rezept 166 the declaration of types which used as 'file of ..' and the variables were in in the implementation section.
I moved my declarations there but it didn't work.
When does such an error occurs ?
What is finalization ?
There is a finalization section but what should I do there ?
Thank you all for yor anwers.
TPicturStreamItem needs finalization not - allowed in filetype.
What does this mean ?
It happens when I try to declare a file of .. type see code below:
procedure TPictureFilemanager.SaveToFile(FileName:string);
var
Entry : TPictureStreamItem;
PEntry : PPictureStreamItem;
x:integer;
SaveFile : file of TPictureStreamItem;//Here does the error occurs.
begin
if FileExists(FileName) then
begin
AssignFile(SaveFile,FileName);
Rewrite(SaveFile);
for x:=0 to PictureStreamEntrys.Count -1 do
begin
PEntry := PictureStreamEntrys.Items[x];
Entry := PEntry^;
Write(SaveFile,Entry);
end;
CloseFile(SaveFile);
end
else
begin
FErrormsg.Add('Cant find file: '+FileName);
end;
The procedure is part of the class TPictureFilemanager.
The type TPictureStreamItem;is declared in the same type-section like the class TPictureFilemanager
type
TPictureStreamItem = record
Filename : string;
Marked : boolean;
Transparent : boolean;
FileSize : integer;
Filetype : integer;
Time : integer;
end;
PPictureStreamItem = ^TPictureStreamItem;
TPictureFilemanager = class(TComponent)
private...
In a working example in the "Delphi Kochbuch" Rezept 166 the declaration of types which used as 'file of ..' and the variables were in in the implementation section.
I moved my declarations there but it didn't work.
When does such an error occurs ?
What is finalization ?
There is a finalization section but what should I do there ?
Thank you all for yor anwers.