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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Memo lines

Status
Not open for further replies.

dereka

Programmer
Joined
Apr 23, 2001
Messages
7
Location
GB
Because of my deep distrust of DBF memos I want to break a memo down into lines to store in a 'text' field in a dbf, repecting word breaks. In good old Clipper MLCOUNT and MEMOLINE did the job. I cannot find a way of setting the line length of a memo without trial and error and using fixed font e.g. courier. Has anybody cracked this? or is my lack of faith in memos unfounded ?

Derek Ayshford
 
I'm not 100% sure I fully understand your question, but the following functions should help you acomplish your task:

Var aDBMemo : TDBMemo;
TotalLines, LineLength : Integer;
aChar : Char;
aLine : String;

To get the total number of lines in your memo:
TotalLines := aDBMemo.lines.count;

Obtain line 1 of memo:
aLine := aDBMemo.lines[0];

Length of line 1 (use index 0); Line 2 use index 1 and so on.
LineLength := Length(aDBMemo.lines[0]);

3rd Character of line 2 (Same rule, 1st char use index 0)
aChar := aDBMemo.lines[1][2]

* aDBMemo.lines[index of line][index of character] *

Good luck.

 
Sorry did not explain myself properly. I think I am happy with what you have explained but I want to store the contents of the memo in fields of a character field in a DBF of length 50 using an extra field as the index for line position, so I need to ensure that each line of the memo never exceeds characters. Crudely I placed a memo on the form and worked out its width so that it would accept 50 characters (Non-proprtional font). It seems to work but I was hoping for something more elegant ( and reliable ?)

Derek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top