Home » U++ Library support » RichText,QTF,RTF... » view without pagebreaks?
Re: view without pagebreaks? [message #9740 is a reply to message #9713] |
Tue, 29 May 2007 08:28 |
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. 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!
|
|
|
Goto Forum:
Current Time: Sun May 12 17:41:05 CEST 2024
Total time taken to generate the page: 0.02709 seconds
|