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

2012-05-18 Thread Bernd
2012/5/16 Mark Morgan Lloyd :
> Does anybody have any suggestions for a component to display status or
> terminal text

for simulating a terminal with SynEdit you might also find this helpful:
https://github.com/prof7bit/HaskellTool/tree/master/src

in console.pas there is a TConsole that you just create and give it a
reference to the synedit. It currently has the ghci executable
hardcoded into it but this could also be a shell or some other
interactive command interpreter. In main.pas I just create an instance
of it and pass a reference to the right hand side synedit to it and
then it takes full control over this synedit and works pretty much on
its own.

This does NOT solve the coloring problem (the highlighter that is also
contained in these sources is attached only to the edits on the left
side and is a conventional very simple highlighter for haskell
syntax).

What it does do is demonstrating that simulating an interactive
command prompt with TSynEdit is not so difficult at all.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-17 Thread Mark Morgan Lloyd

Hans-Peter Diettrich wrote:

Mark Morgan Lloyd schrieb:

I assume you have a fixed amount of lines and columns? If so it 
should be very simple to write a pos-highlighter (part of your 
project, does not need to be registerred in IDE), that has


CharAttributes: Array[1..maxLine] of array [ 1..MaxColumn] of TAttribute

Of course that is not practical if you have thousands of lines, as it 
would require a lot of storage


Since it's emulating a mechanical terminal that printed to roll paper, 
the number of lines is indeterminate and increasing. I suppose that I 
could limit it to (say) 1000, but if other people started using it 
there'd be bound to be somebody complain.


Have you ever seen a roll of paper, of indeterminate length? ;-)


Yes. I've also seen all sort of printer problems which can cause the 
number of lines that will fit on a piece- let alone a roll- of paper by 
100%.



And a mechanical terminal with multi-color ribbon?
[Well, I've seen a black/red ribbon many years ago...]


Yes. And more to the point, the terminal that I'm emulating 
/specifically/ has a black/red ribbon which is used in a definite way- 
as shown on the link I posted.


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

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-17 Thread Mark Morgan Lloyd

Martin Schreiber wrote:

On Wednesday 16 May 2012 19:37:16 Mark Morgan Lloyd wrote:

It sounds like a lot of work, shoehorning something which isn't really
its forte into Synedit.

Before anything more, I'll drop a note to Cmdline's author (if he's not
in here already) and see if he's got any suggestions.

Otherwise, can anybody say whether are there any stringgrid derivatives
etc. that will do this?


It probably will not help you but MSEgui has "tterminal" for the purpose. It 
is based on the "tcustomtextedit" widget. "tcustomtextedit" and its 
descendents (ttextedit, tundotextedit, tsyntaxedit, tterminal...) should be 
placed into a "twidgetgrid" and builds a text editor column in the grid. The 
underlying cell datatype is "richstringty", a UnicodeString with per 
character font style and color info. tterminal can start processes and read 
and write pipes.


Doesn't help but is worth knowing ;-)

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

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Martin Schreiber
On Wednesday 16 May 2012 19:37:16 Mark Morgan Lloyd wrote:
>
> It sounds like a lot of work, shoehorning something which isn't really
> its forte into Synedit.
>
> Before anything more, I'll drop a note to Cmdline's author (if he's not
> in here already) and see if he's got any suggestions.
>
> Otherwise, can anybody say whether are there any stringgrid derivatives
> etc. that will do this?

It probably will not help you but MSEgui has "tterminal" for the purpose. It 
is based on the "tcustomtextedit" widget. "tcustomtextedit" and its 
descendents (ttextedit, tundotextedit, tsyntaxedit, tterminal...) should be 
placed into a "twidgetgrid" and builds a text editor column in the grid. The 
underlying cell datatype is "richstringty", a UnicodeString with per 
character font style and color info. tterminal can start processes and read 
and write pipes.

Martin

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Hans-Peter Diettrich

Mark Morgan Lloyd schrieb:

I assume you have a fixed amount of lines and columns? If so it should 
be very simple to write a pos-highlighter (part of your project, does 
not need to be registerred in IDE), that has


CharAttributes: Array[1..maxLine] of array [ 1..MaxColumn] of TAttribute

Of course that is not practical if you have thousands of lines, as it 
would require a lot of storage


Since it's emulating a mechanical terminal that printed to roll paper, 
the number of lines is indeterminate and increasing. I suppose that I 
could limit it to (say) 1000, but if other people started using it 
there'd be bound to be somebody complain.


Have you ever seen a roll of paper, of indeterminate length? ;-)

And a mechanical terminal with multi-color ribbon?
[Well, I've seen a black/red ribbon many years ago...]

DoDi


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Mark Morgan Lloyd

Martin wrote:

On 16/05/2012 16:32, Mark Morgan Lloyd wrote:


Since it's emulating a mechanical terminal that printed to roll paper, 
the number of lines is indeterminate and increasing. I suppose that I 
could limit it to (say) 1000, but if other people started using it 
there'd be bound to be somebody complain.




I see.


Same also applies to any onscreen display of scrolling status etc., 
except that it doesn't have the same insertion-point requirement.



Still possible (at least I think)

Highlighter stores something called a range for each line (line as in 
textbuffer lines, so scrolling of display does not matter)
They are automatically adjusted if lines are added/inserted/removed 
from/to the textbuffer


So you could write a HL, that stores a list of x-positions for each 
line, together with the attributes. (If you edit the line itself, you 
need to adjust the list)
The highlighter can then return the text, cut into "tokens" (in your 
case each continuous group of chars with the same attributes), and 
supply the attributes for each token.


By default the "Range" is not freed, when the line is dropped (e.g. if 
it is an enum or set, then just the memory is dropped).

But the highlighter allows to override that code, so it can be added.

Depends how interested you are.
I can assist, and help put together the framework, but you'll have to 
implement the rest.


It sounds like a lot of work, shoehorning something which isn't really 
its forte into Synedit.


Before anything more, I'll drop a note to Cmdline's author (if he's not 
in here already) and see if he's got any suggestions.


Otherwise, can anybody say whether are there any stringgrid derivatives 
etc. that will do this?


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

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Martin

On 16/05/2012 16:32, Mark Morgan Lloyd wrote:


Since it's emulating a mechanical terminal that printed to roll paper, 
the number of lines is indeterminate and increasing. I suppose that I 
could limit it to (say) 1000, but if other people started using it 
there'd be bound to be somebody complain.




I see.

Still possible (at least I think)

Highlighter stores something called a range for each line (line as in 
textbuffer lines, so scrolling of display does not matter)
They are automatically adjusted if lines are added/inserted/removed 
from/to the textbuffer


So you could write a HL, that stores a list of x-positions for each 
line, together with the attributes. (If you edit the line itself, you 
need to adjust the list)
The highlighter can then return the text, cut into "tokens" (in your 
case each continuous group of chars with the same attributes), and 
supply the attributes for each token.


By default the "Range" is not freed, when the line is dropped (e.g. if 
it is an enum or set, then just the memory is dropped).

But the highlighter allows to override that code, so it can be added.

Depends how interested you are.
I can assist, and help put together the framework, but you'll have to 
implement the rest.


Also to get the memory to be freed (using dynamic array for ranges), it 
touches a few internal methods. I do not foresee that they will change, 
but 


--
If you look at the 1st example from the tutorial ("SimpleHl").

As I said the ranges move with the lines. And I can make it possible 
that you can store a dynamic array (actually pointer to dyn array) as 
range, and that it will be freed, if a line is removed.


The array could be something like
  TLinePosArray = Array of record
XPos, NumChar: Smallint; // assuming a max line length
Attr: TSynHighlighterAttributes; // could alse be an enum, that you 
map later

  end;
  PLinePosArray = ^TLinePosArray;


The rest should be self-explaining from the tutorial.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Mark Morgan Lloyd

Paul Breneman wrote:

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?


Mark,

I don't have any recommendations but I'm following this message thread 
with much interest.  Last fall I wrote a "serial debug terminal" with 
Free Pascal and fpGUI and that program has proved to be one of the most 
useful simple programs I've written in a long time.  I've customized it 
a few times already for real work projects and I also have some other 
projects planned.  If you want to see how simple the present code is see 
the "DbgTerm.pas" program at this page:

  http://www.turbocontrol.com/easyfpgui.htm


I think that almost everybody who has to deal with non-modem equipment 
or who has demanding modem requirements (e.g. accommodate a mix of 
incoming and outgoing calls and/or obscure protocols) ends up doing the 
same. Something that's particularly badly handled in off-the-shelf 
software is control-line handling (DTR, CD etc.).


Right now you can't put the cursor in the terminal and send characters 
by typing them, but rather there are separate SendEdit and SendButton 
components.  I'd like to implement a more standard "terminal" operation 
so what you are discussing here applies to that.


In my case, I'm collecting keydown events from whatever the visible 
control is, converting them to an internal code (derived from the 
mechanics of the original 2741 terminal), (local echo done here), 
converting that to characters for the serial interface, and finally 
sending those to a serial line or telnet connection. Received data 
(which might be coded differently from what was transmitted) is 
converted to the internal code, written to the same queue that got the 
local echo, the content of which is finally converted to Unicode using a 
table that mimics an IBM golfball and stuffed into the stringlist that 
underlies the listbox or memo control.


A listbox does not have a caret marking the insertion point. A memo 
does, and I can generally force that to indicate the position the next 
keypress will appear after each character is output. Obviously that can 
be confused by a mouse click, but since I'm not using the control's own 
keyboard handler the next output character will always appear in the 
right place.


I'm sure all this isn't very efficient, but I am, after all, emulating 
the terminal that gave the World 134.5 Baud operation :-)


I'd like to keep the present DbgTerm as a very simple example of serial 
communications code but I will consider having a more complex terminal 
program too.  I've run into many people who need a replacement for 
HyperTerminal since it has been gone from Vista and later Windows editions.


For Windows I'd point you at Teraterm, of which v1 was Pascal if you 
think you need to tinker. For Linux gtkterm.


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

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Mark Morgan Lloyd

Martin wrote:

On 16/05/2012 14:13, Mark Morgan Lloyd wrote:

Martin wrote:


The normal way (see example):
 // Line 0, from start of line to pos 3 (3 chars) highlighted as 
Attr1

 Highlighter.AddToken(0,3,Attr1);

but this will do a single char
 Highlighter.AddToken(0,3,Attr1);  // Attr1 from col 3
 Highlighter.AddToken(0,4,tkText);  // text from col 4



I don't think any sort of pre-existing custom highlighter will work. 
The requirement here is that anything- completely context-free- that 
the user enters is red, anything that the host supplies (over telnet, 
serial line etc.) is black. Either of those can be complete garbage, 
but should still show up in the correct colour (and should stay 
correct, irrespective of scrolling etc.).


The position highlighter refers to position in text. Scrolling via 
scrollbar is no problem.


But if you add/remove lines; or add/remove chars in a line, you must 
update the positions.


I assume you have a fixed amount of lines and columns? If so it should 
be very simple to write a pos-highlighter (part of your project, does 
not need to be registerred in IDE), that has


CharAttributes: Array[1..maxLine] of array [ 1..MaxColumn] of TAttribute

Of course that is not practical if you have thousands of lines, as it 
would require a lot of storage


Since it's emulating a mechanical terminal that printed to roll paper, 
the number of lines is indeterminate and increasing. I suppose that I 
could limit it to (say) 1000, but if other people started using it 
there'd be bound to be somebody complain.


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

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Martin

On 16/05/2012 14:13, Mark Morgan Lloyd wrote:

Martin wrote:


The normal way (see example):
 // Line 0, from start of line to pos 3 (3 chars) highlighted as 
Attr1

 Highlighter.AddToken(0,3,Attr1);

but this will do a single char
 Highlighter.AddToken(0,3,Attr1);  // Attr1 from col 3
 Highlighter.AddToken(0,4,tkText);  // text from col 4



I don't think any sort of pre-existing custom highlighter will work. 
The requirement here is that anything- completely context-free- that 
the user enters is red, anything that the host supplies (over telnet, 
serial line etc.) is black. Either of those can be complete garbage, 
but should still show up in the correct colour (and should stay 
correct, irrespective of scrolling etc.).


The position highlighter refers to position in text. Scrolling via 
scrollbar is no problem.


But if you add/remove lines; or add/remove chars in a line, you must 
update the positions.


I assume you have a fixed amount of lines and columns? If so it should 
be very simple to write a pos-highlighter (part of your project, does 
not need to be registerred in IDE), that has


CharAttributes: Array[1..maxLine] of array [ 1..MaxColumn] of TAttribute

Of course that is not practical if you have thousands of lines, as it 
would require a lot of storage





In practice (in this particular project) I'm stuffing characters 
directly into the items/lines property (of whichever output component 
I'm using). In other words I'm not using any of the component's own 
keyboard handling, the reason is that there are several stages of 
translation in between the user pressing a key and it being printed.


SynEdit has a read only property. But that still allows selection and 
moving the caret.


If needed it can be configured to ignore all user input (the previews in 
the IDE option do that). That is srollbars can always be scrolled...



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Paul Breneman

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?


Mark,

I don't have any recommendations but I'm following this message thread 
with much interest.  Last fall I wrote a "serial debug terminal" with 
Free Pascal and fpGUI and that program has proved to be one of the most 
useful simple programs I've written in a long time.  I've customized it 
a few times already for real work projects and I also have some other 
projects planned.  If you want to see how simple the present code is see 
the "DbgTerm.pas" program at this page:

  http://www.turbocontrol.com/easyfpgui.htm

Right now you can't put the cursor in the terminal and send characters 
by typing them, but rather there are separate SendEdit and SendButton 
components.  I'd like to implement a more standard "terminal" operation 
so what you are discussing here applies to that.


I'd like to keep the present DbgTerm as a very simple example of serial 
communications code but I will consider having a more complex terminal 
program too.  I've run into many people who need a replacement for 
HyperTerminal since it has been gone from Vista and later Windows editions.


--
Regards,
Paul Breneman
www.dbReplication.com - VCL database replication components
www.TurboControl.com - Hardware and software development services
- Educational programming project for environment monitoring
- Information on using FreePascal for embedded systems
- Support information for the TurboPower open source libraries


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Mark Morgan Lloyd

Martin wrote:

On 16/05/2012 13:24, Mark Morgan Lloyd wrote:

Martin wrote:

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.


Yes, though it may be a bit tedious to add.

The normal way (see example):
 // Line 0, from start of line to pos 3 (3 chars) highlighted as Attr1
 Highlighter.AddToken(0,3,Attr1);

but this will do a single char
 Highlighter.AddToken(0,3,Attr1);  // Attr1 from col 3
 Highlighter.AddToken(0,4,tkText);  // text from col 4


It may be easier to write a custom highlighter - there is a tutorial
http://wiki.lazarus.freepascal.org/SynEdit_Highlighter#Creating_a_SynEdit_Highlighter 



samples are also in the example folder (SVN).

I assume you have a fixed amount of lines and columns? It should be easy 
to have it an array of attributes matching each char in each line.



Whatever you do: make sure to switch off the removal of trailing spaces 
(or you can not highlight them...)


There is a property(IIRC Options)



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




The pos highlighter has always been there.


What do you mean more fluid? ...


I don't think any sort of pre-existing custom highlighter will work. The 
requirement here is that anything- completely context-free- that the 
user enters is red, anything that the host supplies (over telnet, serial 
line etc.) is black. Either of those can be complete garbage, but should 
still show up in the correct colour (and should stay correct, 
irrespective of scrolling etc.).


(btw: SynEdit is not part of the LCL. 
And in is MPL/GPL at your choice, as that is what the original SynEdit is)


OK, but in effect it comes as standard which makes it attractive.

SynEdit had a few changes ( 
http://wiki.lazarus.freepascal.org/Lazarus_0.99.0_release_notes#SynEdit )

I tried to get them in before 1.0, hence so many so sudden...
But most of them should not need user changes.

folding highlighters, if you wrote your own, might still be subject to 
change (so I hope it will not be needed, the latest change should do). 
That is because folding still has a lot of changes...

But the basic highlighter should not need to change.

The internal representation of the Textbuffer, and it's Views will 
change. But that should not affect any one...


In practice (in this particular project) I'm stuffing characters 
directly into the items/lines property (of whichever output component 
I'm using). In other words I'm not using any of the component's own 
keyboard handling, the reason is that there are several stages of 
translation in between the user pressing a key and it being printed.


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

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Martin

On 16/05/2012 13:24, Mark Morgan Lloyd wrote:

Martin wrote:

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.


Yes, though it may be a bit tedious to add.

The normal way (see example):
 // Line 0, from start of line to pos 3 (3 chars) highlighted as Attr1
 Highlighter.AddToken(0,3,Attr1);

but this will do a single char
 Highlighter.AddToken(0,3,Attr1);  // Attr1 from col 3
 Highlighter.AddToken(0,4,tkText);  // text from col 4


It may be easier to write a custom highlighter - there is a tutorial
http://wiki.lazarus.freepascal.org/SynEdit_Highlighter#Creating_a_SynEdit_Highlighter

samples are also in the example folder (SVN).

I assume you have a fixed amount of lines and columns? It should be easy 
to have it an array of attributes matching each char in each line.



Whatever you do: make sure to switch off the removal of trailing spaces 
(or you can not highlight them...)


There is a property(IIRC Options)



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




The pos highlighter has always been there.


What do you mean more fluid? ... (btw: SynEdit is not part of the LCL. 
And in is MPL/GPL at your choice, as that is what the original SynEdit is)


SynEdit had a few changes ( 
http://wiki.lazarus.freepascal.org/Lazarus_0.99.0_release_notes#SynEdit )

I tried to get them in before 1.0, hence so many so sudden...
But most of them should not need user changes.

folding highlighters, if you wrote your own, might still be subject to 
change (so I hope it will not be needed, the latest change should do). 
That is because folding still has a lot of changes...

But the basic highlighter should not need to change.

The internal representation of the Textbuffer, and it's Views will 
change. But that should not affect any one...






--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Mark Morgan Lloyd

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]

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2012-05-16 Thread Martin

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)

You can remove all the SynEdit.Keystrokes. And also set it to not react 
to mouse, if required (use MouseActions and make them empty)

You can also set the caret shape, to be a block (full char width).

If you want to loose ballast, you can remove various of the "Markup" 
modules...



--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Displaying text with colour and insertion point

2012-05-16 Thread Mark Morgan Lloyd
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?


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

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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus