[lazarus] Back to regular code questions:

michael at tfdec1.fys.kuleuven.ac.be michael at tfdec1.fys.kuleuven.ac.be
Mon Jun 28 16:56:12 EDT 1999

On Mon, 28 Jun 1999, Shane Miller wrote:

> In our code, in editor.pp we use a TMemo control and add some code to 
> do the colorizing.  Here's the problem:
> Do I have to manually keep the TMemo's LINES property updated whenever
> they press a key?  I mean if they add a character, obvoiusly the LINES
> property has to be updated.  How is this done in Delphi?  I can trap the
> OnChange event (whixch I do) and it works fine but then should I simply
> clear the entire LINES property and grab all the text in the widget again
> and refill the lines property?

1) TMemo shouldn't be able to colorize in the first place, in my opinion.
2) My guess is that Delphi uses a self-made component, (look at the
   bookmarks and breakpoints area) And, most likely, as in KCL they'll
   use a line oriented pretty-printer. So the problem of the lines property
   simply doesn't apply.

RAD is OK for most cases, but often you need some specialized stuff to do
what you want. This is the nice thing about Delphi: You can use RAD, but you
can just as well use plain win32 API calls.

If it is any help: I have made a RTF reader which displays RTF code on a 
canvas. It should compile without problem under FPC. I think it shouldn't be
hard to make RTF code for the screen from the pascal code, and have it 
rendered quickly.

Of course, then the advantage of a memo (the key handling etc) is lost.
If you want I can send the RTF reading/rendering code.


More information about the Lazarus mailing list