Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum Length of String in Delphi property Lines of TMemo [duplicate]

Tags:

delphi

tmemo

I've been searching the reason why the maximum length of String in a TMemo.Lines is 1024, but not found yet.

I have a text file which contains delimited / csv data which length is around 2000 characters. I use a memo to preview it before I process the file.

memo.Lines.LoadFromFile(textFile);

I have set the WordWrap to FALSE, and scrollBar to ssHorizontal. So any record will not be wrapped to the next line.

But when I iterate the memo.Lines, I found that the maximum String hold in each index is 1KB or 1024 characters. The rest is truncated to the next line.

But if I use TStringList to load the file, the row is not truncated to the next index when it reaches more than 1024 characters. This is not happen when I use TRichEdit.

  1. Anyone can explain this phenomena?
  2. Is it the default behavior of TMemo?

I use D2006 to try this.

like image 699
WishKnew Avatar asked Sep 02 '09 02:09

WishKnew


1 Answers

There's a TeamB answer on this thread: https://forums.embarcadero.com/thread.jspa?threadID=14035

I'm surprised that TStringList didn't work for you. I'm not quite sure what you mean by

the row is not truncated to the next index when it reaches more than 1024 characters.

I'm assuming the lines are delimited by newlines or CRLFs. Why would it matter if a CSV line exceeded 1024 characters? Please post more details.

like image 76
TrueWill Avatar answered Oct 04 '22 22:10

TrueWill