[Lazarus] RE : RE : Displaying text with colour and insertion point

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Sat May 19 10:18:15 CEST 2012

Ludo Brands wrote:

>> Very much like a mechanical typewriter, since that was how 
>> terminals of 
>> that vintage behaved. There's example output at 
>> http://wotho.ethz.ch/APL-1130/2741_APL_Demo.png (it's ETH, 
>> but I don't 
>> think there's a Pascal connection), I've got most of a standalone 
>> terminal emulator that behaves in the same way but haven't got the 
>> colour aspect working due to lack of a suitable component 
>> (and lack os 
>> sufficient skill/experience to write my own).
> When you got already that far with Tmemo, try the TRichMemo which is a
> TCustomMemo descendant which allows changing font attributes in the text. It
> has also a LoadRichText and SaveRichText so that you can save the colored
> text to file.

The good news is that TRichMemo is a painless replacement for TMemo, 
despite my various hacks and admitted inexperience. However, when I'm 
using SetTextAttributes() or  SetRangeColor(), should the position 
parameter be based on the number of bytes or the number of characters of 
existing text? I'm having problems getting this right, which I suspect 
are due to the high proportion of non-ASCII characters.

Or put another way, in the simplest case where I want to change the 
colour of the most-recently-added character, what parameters should I be 

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the Lazarus mailing list