Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-06

Back to regular code questions:

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author
to Shane Miller: In our code, in editor.pp we use a TMemo control and add some code to do the colorizing. …
Shane Miller wrote 9 lines
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.

Michael.

Reply by email

Shane Miller

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?

Shane

Reply by email