Board index » delphi » Weird behaviour of TRichEdits

Weird behaviour of TRichEdits

I'm filling a TRichEdit with text and colouring some of the text. If
the work is fairly complicated, the component seems to get confused
and does things like add lines in the wrong order. Does anyone else
have this sort of problem? Does anyone know of a solution? Are there
'better' TRichEdits out there?

Joseph

 

Re:Weird behaviour of TRichEdits


Quote
mcdonn...@econ.bmg.eur.nl (Joseph McDonnell) wrote:
>I'm filling a TRichEdit with text and colouring some of the text. If
>the work is fairly complicated, the component seems to get confused
>and does things like add lines in the wrong order.  ...[snip]

Joseph

This is exactly what I found as well. A pain isn't it?

My guess would be that you've reached the 64K upper limit in the
number of characters the richedit can hold *and still use rich
formatting*. This is a limitation of the underlying windows control,
and not of Delphi itself, (ie we can blame Mr Gates).

As far as I can see, you can use plain unformated text well beyond the
64K limit, but if you use colour or bold etc it gets confused and you
start to get unpredictable results. To find out how much text is
already in your control, you can use "gettextlen".

If you are using NT, you can send the richedit a message telling it to
sort itself out for a higher limit of text size. You can send the
message like this :

SendMessage(  richedit1.Handle,  EM_EXLIMITTEXT, 0,  $7FFFFFF0  );

Note though, that this has NO effect at all in Windows 95, though you
can send it the message.

I'd also like to find a decent richedit control. I've been thinking of
writing one but it's a lot of work. All the alternative controls I've
seen seem to concentrate on adding features (syntax colouring etc)
when all I really want is a richedit that has no stupid capacity limit
and is a bit easier to use (of preference).

Sorry that I can't offer any wonderful solutions like 'use component
X', maybe somebody else will.

Steve

Other Threads