Re: Page Breaks in NSTextViews
Re: Page Breaks in NSTextViews
- Subject: Re: Page Breaks in NSTextViews
- From: tony cate <email@hidden>
- Date: Mon, 25 Aug 2003 17:46:48 -0500
Ahhh..... Page breaks!
It just so happens I've been stumbling around the documentation for the
past two weeks looking for this very answer. Yesterday, I found it - I
think.
From:
file:///Developer/Documentation/Cocoa/TasksAndConcepts/
ProgrammingTopics/TextArchitecture/index.html
"By using multiple NSTextContainer-NSTextView pairs, more complex
layout arrangements are possible. For example, to support page breaks,
an application can configure the text-handling objects like this:
(There's a niffty diagram here that I can't copy.)
Each NSTextContainer-NSTextView pair corresponds to a page of the
document. The gray rectangle in the (missing) diagram above represents
a custom view object that your application provides as a background for
the NSTextViews. This custom view can be embedded in an NSScrollView to
allow the user to scroll through the document's pages."
Basically, each page is in its own NSTextView embedded in a NSView.
Then you print the NSView.
There are two kinds of page breaks to worry about. The first is a soft
page-break caused by the text getting to the end of the page. The
second is the user inserted hard page-break. If you're going to do this
you have to handle both.
If you don't mind, can we keep in touch on this? I've wasted a ton of
time on this 'feature' I thought would take me a day at most. Two minds
are better than one?
Tony
On Monday, August 25, 2003, at 12:00 PM, Glenn Andreas wrote:
>
I'm trying to add the ability to insert a page-break into a text view
>
(well, let the user insert a page break).
>
>
Using TextEdit in page view, I've found that inserting a 0x0c
>
character seems to work (using the unicode keyboard mode to be able to
>
explicity add 000C) - I found no specific unicode "page separator"
>
character like there are a line separator and paragraph separator
>
characters. The problem is that if we aren't in page view mode (which
>
is then like my application), if you enter 000C without it being the
>
first character on the line, all text afterwards disappears.
>
>
I'm guessing that it is somehow saying that 0x0c is the end of a
>
container (and this seems to work well for page view mode since it
>
dynamically adds more containers as needed), though why this is only a
>
problem if it isn't at the beginning of a line...
>
>
All that matters is being able to print these page breaks (I don't
>
need to show a page mode).
>
>
Or is there a better way to do page breaks? Perhaps using a different
>
unicode character that doesn't have a visual representation, and the
>
do special page/line layout while printing (though that sounds like a
>
lot of work just to have a forced page break).
>
Glenn Andreas email@hidden
>
Author of Macintosh games: Theldrow 2.3, Blobbo 1.0.2, Cythera 1.0.2
>
Be good, and you will be lonesome
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.