Hi Robert,

Interesting. Do you reproduce the crash when you use this code into a new Xcode project?

If it only crashes in your app, maybe it's related to your view. How complex is the view?

Laurent

On Sep 10, 2010, at 9:30 AM, Robert Rice wrote:

I tracked down my NSView printing problem to the NSPrintPanel preview view. My view printing now works again by overriding the default option to display the small preview view:

def print
po = NSPrintOperation.printOperationWithView( @printableView )
po.printPanel.setOptions( 0 )
po.setShowsPrintPanel( true )
po.runOperationModalForWindow( @printableView.window, delegate:self,
didRunSelector:"printOperationDidRun:success:contextInfo:", contextInfo:nil )
end

def printOperationDidRun( printOperation, success:success, contextInfo:contextInfo )
puts "printOperationDidRun #{ success }"
end

or I can bypass the printPanel entirely.

It will take more experimenting to find out why NSPrintPanel is not creating a graphics context for my NSView or why it would call my drawRect with an invalid context; it works with my PDFView. But now 
it's a low priority for me since I don't really need the NSPrintPanel preview.

Bob Rice

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel