Kanade's Delphi Stuff
Delphi Tips, Sample code and Tools
Copyright © 1997-2004, Sanjay Kanade
 
  Tips and Tricks on Delphi
Please read the DISCLAIMER before you use any of the tips from this web site. Go to main index
  Delphi Tips: Richedit / Memo related tips
Tip 28:  Getting lines from word wrapped memos
(modified: 01 Dec 1999)


Tip 24:  Richedit related site
(modified: 13 Jan 2001)


  28: Getting lines from word wrapped memos
Date added/modified: 01 Dec 1999

If you use the lines property of a memo to get the lines, you will get the lines as you see them on a word wrapped memo. Most of the time, for instance, when saving to a file, we want the lines as they really exist in the memo. The paragraphs should remain paragraphs without breaking them into lines. For this purpose, you should use the text property of the memo.

You might ask, "How do I get the lines one by one such that true lines are returned, i.e. each para is returned as a line?"

Create a temporary TStringList and set its text property to the text of the memo. This will give you the true lines in the TStringList. Don't forget to free your temporary TStringList object after processing.

  24: Richedit related site
Date added/modified: 13 Jan 2001

I found a very nice web site that documents many tips and gotchas on rich edit controls. Although, the site is a C++ site, it is still very useful for anyone interested in rich edit controls. The site is called Yet another code site.



 

Copyright 1995-2004, Sanjay Kanade. All rights reserved.
All trademarks and copyrights belong to their respective owners.