• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Filtering File Names in NSOpenPanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filtering File Names in NSOpenPanel


  • Subject: Re: Filtering File Names in NSOpenPanel
  • From: Vince Ackerman <email@hidden>
  • Date: Thu, 7 Jul 2005 12:00:36 -0700


I need the user to point to and open certain files and they all end in the "xxxxxxxsli.doc", the first part changes from month to month. I guess I could just look at the file name OpenPanel returns and then put up an error message if the user doesn't select the right file.


Thanks,

Vince


On Jul 7, 2005, at 10:45, Charilaos Skiadas wrote:


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
  • Follow-Ups:
    • Re: Filtering File Names in NSOpenPanel
      • From: Andy Lee <email@hidden>
    • Re: Filtering File Names in NSOpenPanel
      • From: Charilaos Skiadas <email@hidden>
References: 
 >Filtering File Names in NSOpenPanel (From: Vince Ackerman <email@hidden>)
 >Re: Filtering File Names in NSOpenPanel (From: Charilaos Skiadas <email@hidden>)

  • Prev by Date: Re: How to bind only on edit?
  • Next by Date: Re: Filtering File Names in NSOpenPanel
  • Previous by thread: Re: Filtering File Names in NSOpenPanel
  • Next by thread: Re: Filtering File Names in NSOpenPanel
  • Index(es):
    • Date
    • Thread