Re: Printing
Re: Printing
- Subject: Re: Printing
- From: Matt Neuburg <email@hidden>
- Date: Fri, 6 Sep 2002 22:26:35 -0700
On Fri, 06 Sep 2002 08:38:52 +0100, email@hidden said:
>
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.
[snip]
>
Ok - so if I dont call runOperation, but call
>
>
[op runOperationModalForWindow: ...]
>
>
I get the popup but the function appears to return straightaway.
I can think of two misconceptions you might be having.
(1) If you're coming from a REALbasic background - and it sounds vaguely as
if you might be - you may not understand what "modal" means in a Cocoa
context. The notion "run modal" in Cocoa has to do with limitations on what
events the application will accept; it does not, as in REALbasic, magically
and mysteriously stop the execution of the current method until the modal
window is gone. This is why it typically takes two or three methods to put
up a modal window in Cocoa: one to put it up (and it typically then returns
immediately), one to react to button presses, and (optionally) one to take
control when the modal state is brought to an end (by the second method).
(2) Printing in Cocoa, quite like printing in REALbasic, is simply drawing.
When you learn that your user wishes to print, construct your view and draw
it; when it's ready, hand it to +NSPrintOperation printOperationWithView:.
You are now ready to print, so take the result of that call, call
-runOperationModalForWindow (or whatever), and that's the end. You don't
care that the "function returns straightaway" because that's the end
anyhow. In other words, by the time you got to this point, you basically
already printed, because you already drew into your view. I oversimplify
but this should get you started.
m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.