• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
[still having probs] Re: Printing my document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[still having probs] Re: Printing my document


  • Subject: [still having probs] Re: Printing my document
  • From: Graham J Lee <email@hidden>
  • Date: Wed, 22 Jun 2005 15:13:25 +0100

On 24 May 2005, at 15:04, Graham J Lee wrote:

On 23 May 2005, at 17:00, Fritz Anderson wrote:

On 23 May 2005, at 7:42 AM, Graham J Lee wrote:

Now, how do I go about printing that? I've overridden -printDocument: in my NSDocument subclass, and get the following results:

-(void)printDocument:(id)sender
{
[super printDocument:sender]; /* does nothing */
[tableView print:sender]; /* print the contents (though not column headings) of the table view */
[graphView print:sender]; /* print the graph view out very nicely */
}


However, the tableView and graphView prinouts get sent (perhaps unsurprisingly) as separate print jobs. What I'd like to do is print the tableView followed by the graphView on the same (printer) document, even if they don't fit on the same page. How could I acheive that?

Without promising to omit the headers or do it very nicely, I'd say you create an NSView big enough to hold both views, lay them out inside it, and print that. Return the views to their original superviews when you're done.



OK, so assuming I don't exactly know how to do that... :-)

Actually, it's going quite well; following your suggestion and Ali Lalani's post about constructing an offscreen NSView, I've done this:

NSWindow *offscreen=[[NSWindow alloc] initWithContentRect:NSMakeRect(-1000,-1000,800,600) styleMask: NSTitledWindowMask|NSClosableWindowMask backing: NSBackingStoreNonretained defer:NO];
[[offscreen contentView] addSubview:tableView];
[[offscreen contentView] addSubview:graphView positioned:NSWindowBelow relativeTo:tableView];
[[offscreen contentView] print:sender];
[offscreen close];


What this currently doesn't do is sort out the relative origins of the two subviews; how do I do that?

OK, so this has been on the back burner for a while, but I still don't see how to draw a subview "somewhere else" in a view, rather than clobbering the previosuly-added subview. I've tried using -translateOriginToPoint: but that doesn't do it. What I want is for the tableView and the graphView to be printed as part of the same print job. Should I use beginPage, add one view, endPage, beginPage, add other view, endPage, then print? How could I lay the two subviews out on the same page?


Cheers,

Graham.
--
Graham Lee                       GPG Key ID: 01D5B9D8
UNIX Systems Manager,
Oxford Physics Practical Course
http://nextstep.sdf-eu.org               01865 273450

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: [still having probs] Re: Printing my document
      • From: Graham J Lee <email@hidden>
  • Prev by Date: Re: Design Dilemma ...
  • Next by Date: Re: Problem with protocols using gcc 4
  • Previous by thread: Re: getting drive/media type (CD/DVD only)
  • Next by thread: Re: [still having probs] Re: Printing my document
  • Index(es):
    • Date
    • Thread