Re: Choosing Files Based Upon Type
Re: Choosing Files Based Upon Type
- Subject: Re: Choosing Files Based Upon Type
- From: Richard Schreyer <email@hidden>
- Date: Mon, 18 Jun 2001 14:22:30 -0700
On Monday, June 18, 2001, at 12:12 PM, Joe Muscara wrote:
On Thursday, June 14, 2001, at 02:17 PM, Ali Ozer wrote:
But rest assured that Cocoa is constantly being enhanced
(for instance, in 10.0 open panel can now choose files based on types
in
addition to extensions).
While I did find this mentioned in the introductory text for the
NSOpenPanel help page, I haven't been able to figure out how to
actually implement it. All I could think of trying was
NSArray *fileTypes = [NSArray arrayWithObject:@"TEXT"];
but that resulted in the obvious - only allowing selection of items
whose extension was "TEXT."
How is this done? And, am I reading the original post correctly that
this has been available since 10.0?
To get NSOpenPanel to choose files based on type, you use 'TEXT'. The
surrounding single quotes indicate a type code, not a file extension.
For example, you might want:
NSArray *fileTypes = [NSArray arrayWithObjects:@"txt", @"'TEXT'"];
This is available in 10.0.0.
Richard Schreyer