• 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: extending NSSavePanel, how to disable <save> button?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extending NSSavePanel, how to disable <save> button?


  • Subject: Re: extending NSSavePanel, how to disable <save> button?
  • From: Eric Slosser <email@hidden>
  • Date: Fri, 26 Jun 2009 15:06:10 -0400

I have a static text string "passwords must match" that I show whenever they don't. (to see the keystrokes, I made a delegate for the password fields that overrides controlTextDidChange:, and to hide/ show the NSTextView, I call NSView's setHidden:).

If the person clicks <Save> anyway, I cause it to be ignored (a delegate to NSSavePanel that overrides -(NSString*) panel:userEnteredFilename:confirmed, and returns nil), AND I kick off an animation loop that makes the text fade in and out every half second. (NSViewAnimation)

On Jun 25, 2009, at 12:42 PM, Mike Abdullah wrote:

I'm pretty certain there is no proper API for disabling the Save button. But the delegate methods will allow you to stop the button from taking effect (weird I know). I suggest you do an NSBeep() at the same time to at least give some feedback as to why the panel couldn't close.

Mike.

On 24 Jun 2009, at 18:52, Steve Christensen wrote:

I haven't tried myself, but just checking the headers it looks like the closest thing would be to make your controlling class the delegate and then implement either

- (BOOL)panel:(id)sender isValidFilename:(NSString *)filename;

or

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

since they control whether to allow the selection process to complete. The docs for these methods have more details that might help you decide which would be better.

steve


On Jun 24, 2009, at 10:42 AM, Eric Slosser wrote:

I'm extending NSSavePanel by using an accessory view. The view contains two NSSecureTextFields, to contain the user-typed password and confirmation.

I know how to detect when the two password fields don't have identical content, to display a warning string on the dialog, and to prevent the user from exiting the dialog.

But I'd also like to disable the <Save> button. Is it possible?

_______________________________________________

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



_______________________________________________

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


References: 
 >extending NSSavePanel, how to disable <save> button? (From: Eric Slosser <email@hidden>)
 >Re: extending NSSavePanel, how to disable <save> button? (From: Steve Christensen <email@hidden>)
 >Re: extending NSSavePanel, how to disable <save> button? (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: Fixing logged error that doesn't throw exception
  • Next by Date: Re: GC pros and cons
  • Previous by thread: Re: extending NSSavePanel, how to disable <save> button?
  • Next by thread: Re: GC pros and cons
  • Index(es):
    • Date
    • Thread