On May 28, 2010, at 11:04 AM, Kevin Wojniak wrote:

>> *4)** **I **can't call the printing code*
>> 
>> I know, the printing code calls me. But other platforms don't work like
>> this. I eventually used Core Printing and the Cocoa dialogs by sub-classing
>> and faking out NSPrintPanel. Is there a better way?
> 
> Can you be more specific? Have you looked at NSPrintOperation 
> setShowsPrintPanel: ?
> 
> 


I haven't read the entire thread so apologies if I'm missing something, but 
this snippet brings back a memory and I wonder if the same thing is happening 
to you.

I wanted to write a simple application that included printing.  All I wanted to 
do was print my NSView.  

I was coming from a C++ background, so I started looking around for a print 
manager object to give me a printer object to subclass.  I searched high and 
low.  I could find things that looked like they were close, but nothing really 
matched up.  How stupid could Cocoa be I thought?  All I want to do is get a 
reference to the default printer, and call some "printWithObject" method and 
pass it my view.  I spent hours looking and couldn't believe Cocoa could make 
something so simple so complex.

The problem of course was that I was coming at it from a C++ background and 
trying to shoehorn my C++ thinking onto Cocoa.

So, what did the solution end up being?

[myView print];

The lesson?  If it seems ridiculously hard, you're likely making it hard with 
incorrect assumptions.  Cocoa likely has an easier way.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to