[Lazarus] Displaying text with colour and insertion point

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed May 16 14:24:46 CEST 2012


Martin wrote:
> On 16/05/2012 09:13, Mark Morgan Lloyd wrote:
>> Does anybody have any suggestions for a component to display status or 
>> terminal text that will allow limited enhancement (colour, possibly 
>> underline etc.)?
>>
>> Over the last few weeks I've been tinkering with an emulator for an 
>> obsolete mechanical terminal (IBM 2741), including support for the APL 
>> character set. I started off using a listbox for simple output, noting 
>> that this didn't have provision for multiple colours or marking the 
>> insertion point. I moved on to stuffing characters into a memo, this 
>> allowed me to force a current-position marker but still had no colour.
>>
>> Looking at the CmdLine component, it appears OK as a command window 
>> (i.e. accepting keyboard input etc.) but isn't so hot when the 
>> principal requirement is to display text pushed into the underlying 
>> strings storage from elsewhere: in particular, there isn't a way to 
>> force the insertion point marker to the end of what's just been output.
>>
>> I'm sure I'm not the only person who wants to do this sort of thing: 
>> does anybody have any recommendations?
>>
> 
> TSynEdit? TSynPosSyn (position highlighter, see examples)

Do you mean that that can now colour arbitrary sequences of characters 
(i.e. what you'd expect from a terminal emulator), rather than having to 
define things in advance? As an example, see 
http://wotho.ethz.ch/APL-1130/2741_APL_Demo.png where everything the 
user enters (which starts at the 7th column) is printed in red.

Being able to use a standard component would definitely be an advantage, 
since particularly for this project I am very keen on a user with 
limited (or no) Pascal experience simply being able to grab the sources 
and a copy of Lazarus and compile.

But I must also ask: how long has TSynedit done this? It does appear to 
be one of the more fluid parts of the LCL and I'm afraid I'm a bit wary...

-- 
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