Home » U++ Library support » RichText,QTF,RTF... » Scrollable log window with colour text
Scrollable log window with colour text [message #2539] |
Mon, 17 April 2006 08:38 |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
Rather than thread-jacking my old... thread.. I thought I would start afresh on this question.
If you imagine a FTP client, I want a window where I can throw the log output, and other garbage returned from the other end, into and have it scroll as it fills up. But I would like to be able to have colour text so I can do an ANSI->QTF convert.
I have been trying RichTextView, which seems to be the simplest of the Rich text categories, but I have having some issues.
[1]
The only way so far to add another line of text at the "bottom" is to re-assign the entire contents.
p = ~p + str;
[2]
Automatically scroll so latest line is in view. So far this has not been possible with RichTextView, but, I found that if I tag on "[:END:]&" to my text, I can use GotoLabel("END", false). Yeah, not pretty.
Is there no better way? It would be nicer to use something like DocEdit with its .Insert() and SetCursor() but it doesn't do colour text.
I tried RichEdit as suggested, but found it had the same issues as mentioned here.
Advice please, production stopped here
|
|
|
|
|
Re: Scrollable log window with colour text [message #2554 is a reply to message #2549] |
Mon, 17 April 2006 19:50 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
lundman wrote on Mon, 17 April 2006 12:01 |
Having a look at that, seems to be that you can define Keywords that controls the colours it should paint it. Not sure if I can directly use it. If I match on the ANSI codes directly, or even if I pre-parse it to replace it with some different magic, it will still print/display those "control codes" to the user.
That's assume I understand that code, and I don't think I do.
|
Could make more clear - would you like to display those ANSI codes or would you like them filtered?
[Updated on: Mon, 17 April 2006 19:53] Report message to a moderator
|
|
|
|
Re: Scrollable log window with colour text [message #2581 is a reply to message #2554] |
Tue, 18 April 2006 02:18 |
lundman
Messages: 175 Registered: March 2006 Location: Tokyo
|
Experienced Member |
|
|
The solution I want is to be able to print ANSI encoded text. Now, I can leave the ANSI code in there, ESC [ X ; Y ; Z ], and attempt to match on that, but with the unprintable etc, I do not know if that will work or fail. Naturally, I do not want the escape codes "displayed", just to set the colour.
Or, I can pre-parse the ANSI string, which I do in my ncurses/CDK application, and replace the ANSI colour codes with some other encoding. Could be QTF, but I've had little luck in making a scrollable Window out of that, but today there is a lead there.
But even if I did replace it with markers that are "easier" to match on, wouldn't those markers just be displayed as well as the rest of the text?
"ESC[31mHello ESC[34mWorld" -> RED(Hello) BLUE(World).
"[@6 Hello][@5 World]"
Or in another way, is there a way I can end up with the ability to AddString(fgcolour, bgcolour, "Hello "); AddString(fgcolour, bgcolour, "World");
It would seem that the QTF encoding was made for this sort of thing, it is just that there is no Widget that suits it. Sure if I want to make a Word application, I'm already done.
[Updated on: Tue, 18 April 2006 02:35] Report message to a moderator
|
|
|
Re: Scrollable log window with colour text [message #2582 is a reply to message #2581] |
Tue, 18 April 2006 04:31 |
|
fudadmin
Messages: 1321 Registered: November 2005 Location: Kaunas, Lithuania
|
Ultimate Contributor Administrator |
|
|
ok. There are 3 big problems. The 1st, as I understand, is coloring some text?
One of I my editor experiments.
void DEditor::HighlightLine(int line, Vector<LineEdit::Highlight>& hl, int pos)
{
HlSt hls(hl); //highlights
int posW0=5;
int posW1=20;
if(line == 0 ) {
hls.SetPaper(posW0, posW1, Red);
hls.SetInk(posW0, posW1, Yellow);
}
If that is usefull...
[Updated on: Tue, 18 April 2006 04:34] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Fri Nov 01 01:07:34 CET 2024
Total time taken to generate the page: 0.03294 seconds
|