Board index » delphi » TRichEdit: plain text, yet making certain words bold.

TRichEdit: plain text, yet making certain words bold.

I have a text editor that uses a TRichEdit control.  I have it saving as
plain text.

I would like to be able to make certain words bold and have comments be
certain color.  But still save as text only.  Kindof like a programmers
editor where the reserved words are bold and everything after // is a blue
comment.

How would I go about doing this?  But still having it save as plain text.

 

Re:TRichEdit: plain text, yet making certain words bold.


Quote
> I have a text editor that uses a TRichEdit control.  I have it saving as
> plain text.
> I would like to be able to make certain words bold and have comments be
> certain color.  But still save as text only.  Kindof like a programmers
> editor where the reserved words are bold and everything after // is a blue
> comment.
> How would I go about doing this?  But still having it save as plain text.

Basically you run over the text in code after a file load, find words to
color, select them, color them. If the user can type in the editor you need
to do this kind of stuff while he types, which can be quite challenging if
you want it to have decent performance and not interfere with the typing,
support cut/copy/paste etc..

There are several URLs you may want to look up.

 TColorMemo              http://www.balticsolutions.com
 TSyntaxMemo             http://www.dbrocksoftware.com
 TDreamMemo              http://www.brama.com/dream-co/
 mwEdit                  http://members.xoom.com/primozg/mw/mwedit.htm
                         http://www.eccentrica.org/gabr/mw/mwedit.htm

For learning purpose the mwedit link is the most interesting since it is a
open source project, so you have the source to study.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Other Threads