My documents have 2 main view modes, thumbnails and details, which use 
subclasses of IKImageBrowserView and NSTableView respectively. For printing, I 
need to create a new print-only thumbnail view because IKImageBrowserView 
wasn't written in a way that can print, plus I need to rejigger its frame and 
other things for printing. The NSTableView used in the doc window can be used 
as-is for printing (as long as I don't allow printing in a background thread, 
otherwise it screws with its autolayout in the background, which floods the 
console with exceptions).

I'd like to add pair of radio buttons to my Print panel's accessory view so the 
user can choose between the 2 modes. To handle this, I create an NSView 
subclass that simply holds the thumbnail and table views needed to print. 
Depending on the state of the radios, its drawRect: method will either draw the 
appropriate view. The are *not* added as subviews, because that would remove 
them (the table at least) from doc window hierarchy.

This appears to work fine for the thumbnail view, but the table view is not 
drawing anything into the Print preview or into the context when I actually 
print to pdf. I'm ensuring that when the user changes the view type, I resize 
the wrapper view to match the frame of the thumbnail or table view. Obviously, 
the Print panel knows how to cause an NSTableView that's part of a window's 
view hierarchy to render into the preview and to the print context. How can I 
get the table to draw in my scheme of things? It doesn't look like the print 
preview is doing anything sneaky like temporarily moving the view to the print 
panel or anything like that. Although I do see that it's calling viewWillDraw 
twice when I move the preview to pages that contain the rows that are visible 
in the window, first for the print preview then again for the doc window. If I 
got outside that range, it only gets called once for the print preview.

--
Steve Mills
Drummer, Mac geek


_______________________________________________

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

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

Reply via email to