Board index » delphi » D2: How to change fonts in a RichEdit-component

D2: How to change fonts in a RichEdit-component

I've seen this question before, but never saw replies to it, so I have to ask it
again:
How can I change fonts of keywords in a RichEdit ? I use a selection at the
moment by running through the Text-field of the component and "selecting"
the keywords that need to be changed. I'm hiding the RichEdit-component
while running through it. This works almost as I want it to, but the cursor
blinks.

There must be a better way, isn't it ?...
-----
Alban Hertroys
e-mail: A.G.Hertro...@student.utwente.nl
WWW:    http://wit401310.student.utwente.nl/
The Netherlands
-----
...I'll make no subscription to your paradise. (Crass / Stations of the cross)

 

Re:D2: How to change fonts in a RichEdit-component


Quote
A.G.Hertro...@student.utwente.nl (A.G.Hertroys) wrote:
>I've seen this question before, but never saw replies to it, so I have to ask it
>again:
>How can I change fonts of keywords in a RichEdit ? I use a selection at the
>moment by running through the Text-field of the component and "selecting"
>the keywords that need to be changed. I'm hiding the RichEdit-component
>while running through it. This works almost as I want it to, but the cursor
>blinks.

>There must be a better way, isn't it ?...

I have made an application which does some simple color coding of SGML files, and the strategy
I have followed is to build a complete RTF-string. I have used Eschalon's EPRichEdit, which has a
RichText property, to which I simply assign this string. I would think that the TRichEdit also has
this functionality somehow, but I haven't checked.

ie: The idea is to build the formatted text "from the ground up" using RTF-codes.
It works pretty fast (about 1-3 sec to format a 100K file on a Pentium 90), but of course it requires
knowledge of the RTF-format (not that hard).

Regards,

Jarle stabell

Re:D2: How to change fonts in a RichEdit-component


Quote
Jarle stabell <jarle.sta...@dokpro.uio.no> wrote:

Haven't tried it but... would it work if you converted the current
_line_ of a TRichEdit  and assigned it back to produce keyword
highlighting interactively?

                                Mike Austin

Quote
>A.G.Hertro...@student.utwente.nl (A.G.Hertroys) wrote:
>>I've seen this question before, but never saw replies to it, so I have to ask it
>>again:
>>How can I change fonts of keywords in a RichEdit ? I use a selection at the
>>moment by running through the Text-field of the component and "selecting"
>>the keywords that need to be changed. I'm hiding the RichEdit-component
>>while running through it. This works almost as I want it to, but the cursor
>>blinks.

>>There must be a better way, isn't it ?...

>I have made an application which does some simple color coding of SGML files, and the strategy
>I have followed is to build a complete RTF-string. I have used Eschalon's EPRichEdit, which has a
>RichText property, to which I simply assign this string. I would think that the TRichEdit also has
>this functionality somehow, but I haven't checked.

>ie: The idea is to build the formatted text "from the ground up" using RTF-codes.
>It works pretty fast (about 1-3 sec to format a 100K file on a Pentium 90), but of course it requires
>knowledge of the RTF-format (not that hard).

>Regards,

>Jarle stabell

Re:D2: How to change fonts in a RichEdit-component


Quote
m.aus...@ix.netcom.com (Mike Austin) wrote:
>Haven't tried it but... would it work if you converted the current
>_line_ of a TRichEdit  and assigned it back to produce keyword
>highlighting interactively?

Maybe, if the _line_ contains RTF-formatting codes. I haven't check the
Lines property of TRichEdit, maybe it only contains the text and not the
formatting?

Regards,

Jarle stabell

Other Threads