• 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: NSSavePanel delegate Methods called by NSOpenPanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSavePanel delegate Methods called by NSOpenPanel


  • Subject: Re: NSSavePanel delegate Methods called by NSOpenPanel
  • From: Steve Christensen <email@hidden>
  • Date: Fri, 10 Jul 2009 08:37:23 -0700

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 (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: NSSavePanel delegate Methods called by NSOpenPanel
      • From: Daniel Demiss <email@hidden>
References: 
 >NSSavePanel delegate Methods called by NSOpenPanel (From: Daniel Demiss <email@hidden>)

  • Prev by Date: Re: Confused about NSPrintInfo margins
  • Next by Date: Re: NSCondition (unlocked when not locked)
  • Previous by thread: NSSavePanel delegate Methods called by NSOpenPanel
  • Next by thread: Re: NSSavePanel delegate Methods called by NSOpenPanel
  • Index(es):
    • Date
    • Thread