Re: six things I wasn't able to do with Cocoa
Re: six things I wasn't able to do with Cocoa
- Subject: Re: six things I wasn't able to do with Cocoa
- From: Bill Appleton <email@hidden>
- Date: Fri, 28 May 2010 09:20:31 -0700
hi all,
wow, i am getting a lot of help solving these last issues! thanks all.
on printing, the problem is that i have to port an enterprise application
that expects to be able to call a fx for the page layout and the page setup
dialog, a fx to begin/end a page, and a fx to begin/end printing.
so Cocoa has this amazing system where you initiate printing and the
printing system CALLS YOU with these requirements, but i need something
where i CALL THEM because i have to port lots of other code.
now, Core Printing implements all this EXCEPT the dialogs, they are
deprecated in 64 bit, so the missing call is PMSessionPrintDialog
so [NSApp runPageLayout] handles page layout no worries, but NSPrintPanel
can only run the page setup dialog in the context of printing an NSView, and
then you get all the callbacks which i can't implement.
so i needed a way to edit the shared printing info with the standard page
setup dialog, then i can get a copy of the shared printing info & call Core
Printing, all is well
so i did that by subclassing NSPrintPanel and makeing it return "cancel" to
NSPrintOperation even when the shared printing info was actually edited
so that is a rather nasty solution -- but basically anyone trying to port a
large code base with printing is going to run right into this issue....
unless i'm missing something
best,
bill
On Fri, May 28, 2010 at 9:04 AM, Kevin Wojniak <email@hidden> wrote:
>
> On May 27, 2010, at 12:43 PM, Bill Appleton 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: ?
>
> > *5)** **I **can't create a simple list*
> >
> > I did it the only way I could -- with a table that has one column, etc.
> Man
> > that was painful for a simple list. Is there a better way?
>
> As others have said, but I'll reiterate, bindings make this ridiculously
> easy.
>
> > *6)** **I **can't get the height of some wrapped text*
> >
> > I had to use the layout manager and some major rocket science to get this
> to
> > work right. I'm not saying Text Edit was great, but at least it knows how
> > tall the text field is.
>
> I have a method for doing this and once the initial data is created and
> cached, it takes 4 lines of code to calculate the height of text for a
> width. While it's not as obvious as -[NSAttributedString size], I certainly
> wouldn't consider it rocket science :). I believe the code originated from
> Apple's docs too.
>
> Kevin
>
>
_______________________________________________
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