Re: Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?
Re: Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?
- Subject: 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>
- Date: Sun, 23 Mar 2003 01:17:06 -0500
Have you also got a file type set in the passed types array?
this causes the ChooseFiles NO to be ignored.
On Saturday, March 22, 2003, at 05:16 PM, email@hidden wrote:
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.
_______________________________________________
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.