Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What means "<Record> need finalization not allowed in.."

Status
Not open for further replies.

David28

Programmer
Nov 14, 2004
8
DE
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.



 
I have found the error,
I didn't know that tehe string Filename in TPictureStreamItem has to be limited (string[255] for example).
Thank you all who read this and perhaps thought about.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top