Quick links : Introduction | News | Basics | Screen Shots | Download | Ordering


We encountered a need to "color code" html tags. That pushed us to development of memo component that would be able to "color" the text it contains. We felt a need in it because RichEdit that comes with Delphi is just too much for us and requires a DLL to be installed ( and the right version of it ). Not to mention that it's too complex for novice users and not flexible enough for advanced ones.

With version 1.0, we tried to make it very simple and easy to use so novice users can "plug&play" it into their application without any painful reading of manuals. And at the same time it should allow more advanced user to implement any imaginable set of "color coding" rules. Yes, we know it's hard to achieve both goals, and it's up to you judge how we succeeded.

After it's great success and feedback we received, we were sure about it's easy of use and concentrated our efforts on features requested by users. We rewrote this product with new architecture in mind.
ColorMemo 2.x now has an editor, new help file, improved demo. Unlimited number of rules can be defined ( even of same type ). Colors can be defined either for each tag or a group of them.

Small Note : It's not compatible with 1.2, but this gave us an opportunity to make it "so powerful" :)

Starting from this release, it must be installed using cmemo.pas instead of colormemo.pas ( or *.dcu if you haven't purchased sources ).

What's new.

in version 2.0.2

in version 2.0.1

Here are some basics of TColorMemo.

Coloring rules can be of types :

Begin-end : for tagged data. Let's say <;>;blue will paint all tags in blue. Their can be lots of begin / end / color pairs for each tag or a group of them. All the text between Begin and End markers is drawn in your color. This is useful when implementing HTML editors and coloring other text where starting and ending markers are available. For the figure at the left we used " < " and ">" symbols as markers for blue HTML tags. Plus "{" and "}" for grey pascal style comments. And here is what we've got as an output.
Key-Show : You provide a list of "keywords" and ColorMemo draws them in colors of your choice. That's how Delphis own editor is implemented ( we guess so ).

You enter keywords or groups of them and colors to draw them in :

Very useful for editors of scripting languages or other simple text that has a pre defined set of words to highlight. For the figure at the left we used some words from Object Pascal language as Keywords. And here is what we've got as an output.
Begin-end-line : for // comments or similar things when everything after
some symbol(s) are painted in defined color until end of line is found

Look at the figure at the left. It's an excerpt from real world example
Event-draw : You specify an even and it is called for each piece of text that needs to be drawn. Your event then returns text pieces along with colors for them. After that we draw text in colors you supplied. Your event can say :
"from symbol 1 to 10 draw in green and from 12 to draw in red , etc."

With this method you can implement almost any rules of color coding that our own set of rules misses.
You can also specify an event for additional keyword drawing. By implementing it you take the responsibility to draw keyword on memo's canvas. You can draw images instead of some keywords or just add a appearance to them. Just like in the figure at the left.bold / italic / underline

You can have lot's of rules ( even at runtime ). But in that case watch for right z-orders so you don't get unexpected results. You assign z-order property to control how overlapping rules must be used. When conflicting situation is found - the winner is rule with bigger z-order :) So Z-Order actually means - priority. The bigger the number, the bigger the change for particular rule to draw particular character.

The HotSpot property is used for making WinHelp HTML Browser effect. The OnHotSpotClick event can be used to be notified when user clicks on particular hotspot.
HotSpot feature is rather new ( or "Beta" of you want ). So there still may be some bugs, features that are "undocumented" :) Suggestions are welcome.
And here is what you can get as an output :-)

More information

Version : 2.0.1
Platform : 32 bit, that is Windows95/NT only.
Requirements : Borland Delphi 2.0 / 3.0 / 4.0

Check screen shots from a demo that we admire you to download.

Download information

Go to downloads page for details on how and where to get the required files.


TColorMemo is a freeware component. You can use it free of charge, but if you want to get it's sources then you must register and pay for it. Registered user get complete sources of component as well as Data-aware version of it - TDBColorMemo.
Go to our ordering page for details.

© Copyright (1997) by Baltic Solutions.