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: Ken Ferry <email@hidden>
- Date: Fri, 28 May 2010 00:09:32 -0700
Hi Bill,
Thanks for the postmortem. Would you mind filing bugs for the items you
think are too difficult?
On Thu, May 27, 2010 at 12:43 PM, Bill Appleton <
email@hidden> wrote:
> hi all,
>
>
> I just ported a huge code base to Cocoa, Core Graphics, Core Audio, and
> QuickTime. Basically I had a good experience, but there were some things i
> noticed that i couldn't do easily in Cocoa or any other 64 bit OSX API.
>
> So just in case anyone knows a way to do the things listed below please let
> me know:
>
>
> *1) I can't hide a file, or test if a file is hidden*
>
> I had to resort to FSGetCatalogInfo -- there is no way to do it through
> NSFileManager, etc. Right?
>
These two are pretty easy in 10.6. -[NSURL getResourceValue:forKey:error:]
/ -[NSURL setResourceValue:forKey:error:] with NSURLIsHiddenKey. Cocoa is
trying to standardize on URLs rather than paths.
> *2)** **I **can't **get the current caret blink rate in milliseconds*
>
> I used to call GetCaretTime, but now I just use 500 milliseconds. Eeek!
> Where is the current blink rate? Please don't tell me I don't need it, we
> implement our own scripting engine, etc.
>
The actual default rate is once per 0.56 seconds.
*3)** **I **can't get t**he right dimensions for a QuickTime movie or poster
> *
>
> I used to call GetMovieBox, so I tried using [QTMovie posterImage] but the
> NSImage reported a width and height of 100, and then my movie poster was
> really pixelated. How do I get a decent looking movie poster? How do I get
> the original dimensions for movie playback?
>
Perhaps QTMovieNaturalSizeAttribute ? I'm not familiar with this API, but
there are a few size-related attributes.
> *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?
>
I don't understand this one. <
http://developer.apple.com/mac/library/documentation/cocoa/conceptual/Printing/Tasks/CreatingPrintJob.html
>.
*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?
>
I'm not sure how much of NSTableView's behavior you want, but it's possible
you'd find NSCollectionView to be simpler.
> *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.
>
NSLayoutManager might be appropriate, but there's also
-[NSString boundingRectWithSize:options:attributes:]. You might find <
http://lists.apple.com/archives/Cocoa-dev/2008/Jan/msg00814.html> helpful.
-Ken
>
>
>
> Thanks!
>
>
> Bill Appleton
> _______________________________________________
>
> 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
>
_______________________________________________
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