Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
lundman is currently offline  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 Smile








Re: Scrollable log window with colour text [message #2540 is a reply to message #2539] Mon, 17 April 2006 08:55 Go to previous messageGo to next message
fudadmin is currently offline  fudadmin
Messages: 1321
Registered: November 2005
Location: Kaunas, Lithuania
Ultimate Contributor
Administrator
Maybe Mirek can offer a better option but I in your place would try to use something from U++ CodeEditor package. I had experimented with it quite succesfully. You can customize keywords and have auto text coloring or start from scratch with LineEdit. Just an idea...
Re: Scrollable log window with colour text [message #2549 is a reply to message #2540] Mon, 17 April 2006 13:01 Go to previous messageGo to next message
lundman is currently offline  lundman
Messages: 175
Registered: March 2006
Location: Tokyo
Experienced Member

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.

Re: Scrollable log window with colour text [message #2554 is a reply to message #2549] Mon, 17 April 2006 19:50 Go to previous messageGo to next message
fudadmin is currently offline  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 #2560 is a reply to message #2539] Mon, 17 April 2006 22:26 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
What about using venerable ArrayCtrl once again?

I have used it for logs a couple of times. Works fine as long as you do not require lines to be wrapped.

Mirek
Re: Scrollable log window with colour text [message #2581 is a reply to message #2554] Tue, 18 April 2006 02:18 Go to previous messageGo to next message
lundman is currently offline  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. Smile

[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 Go to previous message
fudadmin is currently offline  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

Previous Topic: how to get Text Size from controls like EditString?
Next Topic: QTF Justification
Goto Forum:
  


Current Time: Thu Mar 28 16:15:54 CET 2024

Total time taken to generate the page: 0.01330 seconds