• 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
Printing Confusion (Project Builder -> XCode changes)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing Confusion (Project Builder -> XCode changes)


  • Subject: Printing Confusion (Project Builder -> XCode changes)
  • From: Andrew Ebling <email@hidden>
  • Date: Tue, 7 Nov 2006 08:24:00 +0000

I've been following the MathPaper example in "Building Cocoa Applications: A Step-by-Step Guide" (Garfinkel & Mahoney) and have got to the section about printing at the end of chapter 13.

The book claims that printing "just works" in multiple document Cocoa applications. Of course, I quickly found out this was not the case. Yes it's an old book, but I wasn't expecting something as fundamental as printing to have changed much over the years!

Eventually I tracked the problem down to the fact that XCode now links File >> Print to your NSDocument-subclass' printDocument: method, rather than print: which it evidently used to.

Having fixed the problem (by making File >> Print call print: again), I then set about trying to get the default setting to work, but ran into problems (see below).

So my questions are:

- why the change? It must have been done for a reason, so I'm keen to understand the rationale.

- how would I go about getting hold of an NSView to print from, from within my NSDocument-subclass? I tried to obtain the associated NSWindowController, then call window: on that. But that didn't work.

What is the right way to do this? The Apple Cocoa docs on printing assume that you have a printableView method ready to call:

- (void)printShowingPrintPanel:(BOOL)showPanels {

    // Obtain a custom view that will be printed
    NSView *printView = [self printableView];

    // Construct the print operation and setup Print panel
    NSPrintOperation *op = [NSPrintOperation
                printOperationWithView:printView
                printInfo:[self printInfo]];

    [op setShowPanels:showPanels];

    if (showPanels) {
        // Add accessory view, if needed
    }

    // Run operation, which shows the Print panel if showPanels was YES
    [self runModalPrintOperation:op
                delegate:nil
                didRunSelector:NULL
                contextInfo:NULL];
}

But it is the contents of what would go in printableView that has me stumped!

Any help much appreciated.

thanks,

Andy
_______________________________________________
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


  • Prev by Date: Re: Programmatically sort NSTableView
  • Next by Date: bound tableview partly redrawing over covering custom view during resize
  • Previous by thread: Re: Programmatically sort NSTableView
  • Next by thread: bound tableview partly redrawing over covering custom view during resize
  • Index(es):
    • Date
    • Thread