[MacRuby-devel] FYI - Update on NSView printing problem

Robert Rice rice.audio at pobox.com
Fri Sep 10 09:30:24 PDT 2010


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100910/defd2c53/attachment.html>


More information about the MacRuby-devel mailing list