Solved

Delphi Programming question

Posted on 1997-09-06
3
485 Views
Last Modified: 2012-06-27
I have encountered problems with the move from Delphi2 to Delphi3.  I have a reasonably sized record that I like writing to a sequential file.  
I simply used:
"var afile: file of ColumnRecord" and then wrote the records sequentially to a file with standard pascal. (Assigned the file, wrote to "afile", etc.)
Now Delphi 3 won't let me to this with my record and states that
"ColumnRecord needs finalization".  I don't particularly want to  rewrite the record as I would have to rewrite the rest of the software.
a) is there a way around this
b) is there a better way to write sequential records to a file
(such as objects and streams? )  If so, how would I do this?

Enclosed is the code for the record, which in itself contains a record..

type
  FontRecord = record
    Color: TColor;
    Height: Integer;
    Name: TFontname;
    Pitch: TFontPitch;
    PixelsPerInch: Integer;
    Size: Integer;
    Style: TFontStyles;
  end;
  ColumnRecord = record
    ColFieldName: string[80];  // the actual name of the field
    ColWidth: integer;         // width of column
    ColFont: FontRecord;            // font
    ColTitle: string[80];    // title of column
    ColTitleFont: FontRecord;     // title font
    ColLabel: string[80];      // label for field item
    ColLabelFont: FontRecord;        // font of the label
    ColFieldNumber: Integer;   // the table # of the field
    ColVisible: boolean;       // whether to print this column
    ColIncludeLabel: boolean;  // if true, include ColLable
    ColNewLine: boolean;       // starts a new line if true
    ColHideIfEmpty: boolean; // include if empty
  end;

Thank you very much for your help.   EMAIL seitza@docker.com
0
Comment
Question by:seitza
  • 3
3 Comments
 
LVL 3

Accepted Solution

by:
mirek071497 earned 100 total points
ID: 1344191
You must change only one in tFontRecord.

Name : String[LF_FACESIZE-1];

You must change this not only for finalization of record You must change this for compatibility wit previously created files.

Delphi2 define
TFontName = string[LF_FACESIZE-1]
but Delphi3 define
TFontName = type string;

LF_FACESIZE is 32 and all previus files have the size of FontName.

Regards
Mirek
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1344192
do you try my suggestions ?
0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1344193
200pt and you don't need solution?
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now