Re: Filtering File Names in NSOpenPanel
Re: Filtering File Names in NSOpenPanel
- Subject: Re: Filtering File Names in NSOpenPanel
- From: Charilaos Skiadas <email@hidden>
- Date: Thu, 7 Jul 2005 12:45:24 -0500
On Jul 7, 2005, at 12:18 PM, Vince Ackerman wrote:
I need to run an OpenPanel that only allows the display of files
ending in "sli.doc" though the actual name maybe longer, such as
"2005071sli.doc" . I can see how to filter for only ".doc" but I
would like the panel to only find .doc files ending in "sli.doc".
Reading the NSSavePanel docs I see that the delegate handles file
names, but (as a wet behind the ears newbie) I'm not sure how to
use this. Can anyone clue me in?
You could try implementing
- (BOOL)panel:(id)sender isValidFilename:(NSString *)filename
in your delegate, and return NO if the file does not fit your
requirements, but this would not alter the displayed files, just
prevent the user from choosing an inappropriate file.
I would suggest rethinking your design though. Either your app
handles documents of type .doc, or it does not. There is no type of
document sli.doc, so it does not make sense to restrict to such
documents. If your app does indeed only open .doc files of a
particular nature, I would suggest creating your own document type,
maybe .slidoc or something, and renaming those files.
Of course, you could always implement your own open panel with a
browser and all, and do whatever you want with it, but I would
strongly advice against it, for a number of reasons.
Thanks
Vince
Haris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden