printing and the responder chain
printing and the responder chain
- Subject: printing and the responder chain
- From: Torsten Curdt <email@hidden>
- Date: Tue, 04 Oct 2011 12:23:03 +0200
I have a non-document based app. It's a master detail layout with a
NSOutlineView and a custom NSView (in a NSScrollView in a NSSplitView)
on the right. Now when I initiate a "Print" from the menu all that
shows up in the print preview is the outline view.
Reading the documentation from
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Printing/Concepts/architecture.html#//apple_ref/doc/uid/20001053-BAJCHHJG
"Printing is generally initiated by the user choosing the Print menu
command, which usually sends either a print: or printDocument:
message, depending on whether the application is NSDocument-based or
not, up the responder chain. You receive the message either in a
custom NSView object (if it has the keyboard focus), a window
delegate, or an NSDocument object. Upon receipt, you create an
NSPrintOperation object to manage the print job, tell it which NSView
to print, add an accessory view to its print panel, if desired, and
then run the operation. The NSView class defines several methods that
you can override to control how the view is divided between multiple
pages. From there, the view’s drawRect: method draws the view’s
contents"
So I thought I could just implement "print:" in my custom view and
make that view the first responder.
@implementation CustomView
- (void) print:(id)sender
{
NSLog(@"PRINT");
}
@end
...
- (void)awakeFromNib
{
[[self window] makeFirstResponder:self.customView];
Now I expected "Print" would only execute the NSLog. But still the
print dialog comes up and has the NSOutlineView only in the preview.
What am I missing here?
cheers,
Torsten
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden