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: Uli Kusterer <email@hidden>
- Date: Mon, 31 May 2010 12:36:48 +0200
On May 27, 2010, at 9:43 PM, Bill Appleton wrote:
> *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?
Hi Bill,
others have already pointed to NSURL (and CFURLRef).
> *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.
With the death of themeing support and the removal of the Control Panel (with its setting for changing this speed) I guess Apple expects you to just hard-code stuff like that. Can you elaborate what you need it for? Did you mean "text engine" instead of "scripting engine"? Do you have a built-in command in your programming language that exposes the caret rate, or what are you using it for?
> *3)** **I **can't get t**he right dimensions for a QuickTime movie or poster
> *
-attributeForKey: + QTMovieNaturalSizeAttribute, unless you have something weird like a transport stream with aspect ratio changes, but QuickTime generally isn't set up to deal with that, IIRC.
> *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 suppose you can't create an NSView for your needs and then call -print: etc. on that, and have it do the drawing? It would be *almost* like calling the printing code.
> *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 have to admit I thought AppKit's way of handling lists was the simplest out there: You implement -numberOfItemsInTableView: and -tableView:objectValueForTableColumn:row: in whatever object is in charge of the current window/table/whatever (or create a little helper object for this exact purpose), set it as the data source, and you're hunky-dory. It can even on-the-fly-convert from whatever internal data store you have to NSString* for display, and you don't have to pre-allocate a bunch of items like with List Manager or Data Browser. Were you doing something different?
Out of curiosity, what simpler approach to creating a list have you seen?
> *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.
NSTextField or NSTextView? The former is pretty annoying (but is like a DLOG edit field, where you don't have a TEHandle unless you focus it). For the latter, if it's inside a scroll view (which it is by default when created from a NIB, even if you maybe told it to hide its scroll bars & border) you can probably just ask it for its frame and get the correct height that way.
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
_______________________________________________
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