Hi Steve!

Am 10.07.2009 um 17:37 schrieb Steve Christensen:

The documentation for the NSSavePanel class says that the - panel:userEnteredFilename:confirmed: message is "sent when the user confirms a filename choice by hitting OK or Return in the NSSavePanel." That is not an issue for a NSOpenPanel because the user is only choosing among existing files.

Well not quite:
The open panel allows me to create new directories since I did

[panel setCanCreateDirectories:YES];

in my implementation of "pathControl:willDisplayOpenPanel:"
(see code in my first posting).

More curiously:
If I trick the panel in selecting an "invalid" path
through creation of a new directory, I cannot open
that path - which at least is half of what I wanted
to accomplish in the first place...

I guess I'm doing something terribly and obviously
stupid here, but I just don't see it...

Why aren't you just implementing a -panel:shouldShowFilename: method in your delegate to decide which files should and should not be selectable in your NSOpenPanel?

Oh I did. It should have been in the code-excerpt I attached
but I obviously forgot to post it. (Sorry!)
The implementation is trivial...

- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
   return [self isValidPath:filename shouldPresentError:NO];
}

However:
It's just not sufficient because the user actually _should_
be able to create new directories as needed.
And upon creation, they already are selected, so the user can
create a folder with an invalid path, click the "open"-button
and see nothing happen, when I intended to kindly say "Well,
that won't work because...".

The delegate methods you listed in your code snippet are all about validating a new filename when you're going to be saving a file.

What you say makes perfect sense!
That means I have to go the other route and create and set up
a custom field-editor, right?

Or is there another way I haven't seen yet?

Thanks in advance

Daniel
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to