Re: Swapping views in print panel
Re: Swapping views in print panel
- Subject: Re: Swapping views in print panel
- From: Graham Cox <email@hidden>
- Date: Mon, 23 Mar 2015 17:58:57 +1100
> On 23 Mar 2015, at 5:47 pm, Steve Mills <email@hidden> wrote:
>
> On Mar 23, 2015, at 01:15:38, Graham Cox <email@hidden> wrote:
>>
>> Why not just create additional instances of the view that your print panel can use correctly? In the end they look at the same data model, just display it differently. What you seem to be trying to do is make one view do double duty, instead of making a new view of the same data model.
>
> I started off doing that in code, but it was ending up taking way too much code just to correctly set up the NSTableView, columns, delegates, bindings, etc so it would display the data. I guess I could create one in a xib and load it rather than trying to manually create it in code. Bleah. I was just hoping there was a way to do it, since the print panel is obviously able to use the table *on its own* without causing any anomalies in the doc window.
Thinking about this, it's not that clear why you even need a special view for the print panel. You need a view to generate the print content, but that's not quite the same thing. When you create a print job, you pass it a view, which is called automatically (drawRect, etc) and the print job captures what it draws as PDF code that the print panel will display. Your view might need to help the print job out by detecting that it is being called by a print job, and tweaking its content to suit, but mostly it is independent of whether it also lives in a view hierarchy or not - typically it does.
Of course, if you put the control to select list/icon view in the Print Panel, you are going to have to work hard. Alternatively, you could make that something the user chooses in the interface they display, and then just have a Print command on that interface. It prints in whatever form the user has already chosen. I would suggest that this is the usual way to handle that, most apps I've ever seen do it, even the Finder, when it used to support Print (Mac OS 9 and earlier), so users expect it. To be honest adding usable controls to the Print Panel is a royal PITA, you might want to simply avoid it.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden