On Jul 9, 2009, at 6:40 AM, Daniel Demiss wrote:

Hi all,

I'm a little confused by the following situation:

I have an NSPathControl (PopUp-Style) that should only
allow certain paths to be selected.

Therefore I have a controller-object that I set as the
delegate of the NSPathControl and the NSOpenPanel that
will be presented if a user clicks on the "Choose..."
item in the path-popup.

This is working fine except for the delegate method

- (NSString *)panel:(id)sender
userEnteredFilename:(NSString *)filename
         confirmed:(BOOL)okFlag

which somehow doesn't seem to be called.

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.

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? 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.

steve

_______________________________________________

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