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... » view without pagebreaks?
view without pagebreaks? [message #9713] Sat, 26 May 2007 20:45 Go to next message
exolon is currently offline  exolon
Messages: 62
Registered: July 2006
Location: 53'21N 6'18W
Member
Hi, I'm using a RichEdit in uneditable mode without rulers etc to serve as a rich text logging window, since I couldn't figure out how to do it flexibly and quickly with ArrayCtrl and RichTextView soon crashes when adding text to the end, plus there seems to be no way to scroll the RichTextView to the end.

I'm following the approach conveniently taken in this post by Lundman, which works well so far.

The only problem I'm having now is that I can't find a way to stop pagebreak indicators appearing in the output. Since my logging output isn't intended for print view, I want something more like MS Word's 'online view' I think, which just treats the text as an infinitely long page.

Any ideas?
Re: view without pagebreaks? [message #9728 is a reply to message #9713] Mon, 28 May 2007 17:46 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
editor.SetPage(Size(3968, INT_MAX));
icon14.gif  Re: view without pagebreaks? [message #9740 is a reply to message #9713] Tue, 29 May 2007 08:28 Go to previous messageGo to next message
exolon is currently offline  exolon
Messages: 62
Registered: July 2006
Location: 53'21N 6'18W
Member
Thanks, INT_MAX makes sense. I just used some arbitrary fairly big number - I was worried it might have caused some weird side-effects if I set it too huge...

	Size huge = text.GetPage();
	huge.cy = PointDots(270000);
	text.SetPage(huge);

Caused things to eventually go weird after a lot of writing - perhaps 20,000 lines; a new page finally began, but all the text wrote on top of the same line from that point onwards, resulting in a mess of black at the start of the new, final page.

I avoided it by changing it into a FIFO log buffer, which I wanted anyway.

void BridgeLearner::AppendText(String message) {
	text.Disable();
	text.SetEditable();
	int length = text.GetLength();
	if(length > 32767) {
		text.Select(1, 0);
		text.RemoveText(1024);
		length -= 1024;
	}
	text.Select(length, 1);
	text.PasteText(ParseQTF(message));
	text.SetEditable(false);
	text.Enable();
}

Disable() and Enable() while writing to the buffer was necessary to stop the user clicking in the window and changing the cursor/write position. Smile Incidentally, "text.Select(text.GetLength(), 0)" instead of "text.Select(text.GetLength(), 1)" caused segfaults for me sometimes. Not sure why that is.

These components are really well-encapsulated - doing the same thing in Win32 API calls would probably be pretty annoying. And this works exactly the same in Linux and Windows. I like UPP more every time I use it!
Re: view without pagebreaks? [message #9743 is a reply to message #9740] Tue, 29 May 2007 11:01 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Actually, INT_MAX is "magic" value (tested in RichText).

Mirek
Previous Topic: UPP2007.1 - RichEdit, Link Errors
Next Topic: non standard behaviour of table when using backspace?
Goto Forum:
  


Current Time: Thu Mar 28 19:23:01 CET 2024

Total time taken to generate the page: 0.01251 seconds