• 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: [NSOpenPanel] How to disable folder selection but still access their contents?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSOpenPanel] How to disable folder selection but still access their contents?


  • Subject: Re: [NSOpenPanel] How to disable folder selection but still access their contents?
  • From: Corbin Dunn <email@hidden>
  • Date: Thu, 23 Oct 2008 16:20:21 -0700


On Oct 23, 2008, at 1:38 PM, Iceberg-Dev wrote:

Solution not found in the cocoabuilder archive.

Problem:
--------

I have a list of files and folders.

I can add items to this list through a standard NSOpenPanel dialog.

When a folder is already in the list, I want to prevent the user from selecting it from the NSOpenPanel dialog.

I can do this with:

- (BOOL) panel:(id)sender shouldShowFilename:(NSString *) inFileName;

The problem is that this prevents the user from selecting a file within this folder from the NSOpenDialog.

Question:
---------

Is there a way to prevent a folder from being selected but still allow a file within this folder to be selected?

Yes; I think just calling setCanChooseDirectories:NO will work.

If not, then:

1. Don't use shouldShowFilename:
2. Call setCanChooseDirectories:NO
3. Call beginForDirectory:.. types:(your types)

If you have to do some specific dynamic processing to turn on/off enabled types, then you may be out of luck.

Feel free to log a bug requesting to make this process easier. (I already do have some bugs logged for this ability to be easier, so I am aware of the problem).

-corbin
_______________________________________________

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


  • Follow-Ups:
    • Re: [NSOpenPanel] How to disable folder selection but still access their contents?
      • From: Iceberg-Dev <email@hidden>
References: 
 >[NSOpenPanel] How to disable folder selection but still access their contents? (From: Iceberg-Dev <email@hidden>)

  • Prev by Date: Re: NSData and NSImage
  • Next by Date: Re: enumerating the NSApplication instances?
  • Previous by thread: [NSOpenPanel] How to disable folder selection but still access their contents?
  • Next by thread: Re: [NSOpenPanel] How to disable folder selection but still access their contents?
  • Index(es):
    • Date
    • Thread