• 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
Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?


  • Subject: Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?
  • From: email@hidden
  • Date: Sat, 22 Mar 2003 23:16:45 +0100

PROBLEM:

Having a delegate for a NSOpenPanel and using the - (void)setCanChooseFiles:(BOOL)flag; or - (void)setCanChooseDirectories:(BOOL)flag; method is incompatible.

Example:

NSOpenPanel *oPanel = [NSOpenPanel openPanel];

[oPanel setCanChooseDirectories:YES];
[oPanel setCanChooseFiles:NO];
[oPanel setPrompt:NSLocalizedString(@"Select", @"No comment")];

[oPanel setDelegate:self];

[...]

- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
NSRange tRange;

tRange=[filename rangeOfString:@" "]; // Prevents listing files/folder with space in their name

return (tRange.location==NSNotFound);
}

RESULT:

This code leads to every folders and files without a space in their name being listed.

This should not be the case according to the AppKit documentation (I checked the new on-line doc too) which is not saying anywhere that setting a delegate for a NSOpenPanel would make the Open Panel not take into account the calls to setCanChooseDirectories: or setCanChooseFiles:.

QUESTION:

Is this a bug in the AppKit code or a lack of clear explanation in the AppKit documentation?

SIDE QUESTION:

In both cases, since one haves to cope with this behavior, what is the fastest solution to know if a path points to a folder? Is it fileExitsAtPath:isDirectory: or is there another API used by the NSOpenPanel code?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?
      • From: Scott Anguish <email@hidden>
  • Prev by Date: NSTextField problem
  • Next by Date: Re: NSTextField problem
  • Previous by thread: Re: NSTextField problem
  • Next by thread: Re: Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?
  • Index(es):
    • Date
    • Thread