Printing
Printing
- Subject: Printing
- From: email@hidden
- Date: Fri, 06 Sep 2002 08:38:52 +0100
I am trying to add printing support to my app and am being totally stumped
on how to do this. I have read all the apple docs and scoured the web -
very few examples. I have scoured the list for past examples.
This is the issue. I want to print - I want it to be modal.
So I knock up code like this:
NSPrintInfo *pinfo= [[NSPrintInfo] sharedPrintInfo];
NSPrintOperation *op = [NSPrintOperation printOperationWithView: myview
printInfo: pinfo];
// ok so far
Now if I call:
[op runOperation];
I get a modal printer setup dialog. Fine. Now if I click on Cancel, the
function returns and my application is hosed - no more events get thru.
(Just system beeps at me). I can put a breakpoint on [NSApplication sendEvent:]
and that fires as I click or press a key. I have even tried resetting the
first responder (could be doing that wrong), and no joy.
Ok - so if I dont call runOperation, but call
[op runOperationModalForWindow: ...]
I get the popup but the function appears to return straightaway.
I need to call a function which is modal - wait for the print panel
setup to be finished and then continue execution.
Note the view class is custom (no I dont use or want window controllers
or document controllers). E.g. consider an app that wants to print a file
as a subroutine:
print_file(char *filename)
{
<<here!!>>
}
How do I do this? In the past when I have been stumped, I usually find that
its something silly stopping me going. With printing - I cannot find the
'missing link' and there are just not enough samples to show this
(ie samples not based on NSDocument).
One final question - subclassing. Given that [NSPrintOperation printOperation...] is a +[] class method, how can I subclass NSPrintOperation
(or should I even need to try?) Maybe I am not intercepting a method
properly, but I dont see I can override NSPrintOperation if one
of its methods magics a class out of thin air, rather than [[.. alloc] initXXX]
it.
thanx
_______________________________________________
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.