Re: Disabling buttons in NSSavePanel
Re: Disabling buttons in NSSavePanel
- Subject: Re: Disabling buttons in NSSavePanel
- From: Steve Christensen <email@hidden>
- Date: Mon, 29 Jun 2009 09:13:56 -0700
A question about disabling the Save button was just asked on this
list a few days ago. The thread is archived here: <http://www.mail-
archive.com/email@hidden/msg38421.html>. Google is your
friend...
steve
On Jun 29, 2009, at 6:45 AM, Michael Domino wrote:
I use an NSSavePanel to select a file, enter and confirm a
password, encrypt
it and save a copy with a new extension. There is an accessory view
for
entering and confirming a password. I would like the OK button to be
disabled while there is no file selection, and if the password/confirm
password fields are empty and/or don’t match. I use
NSNotificationCenter to
observe the text fields to check whenever the user enters text and
enable/disable the OK button. This all nearly works, the only
problem is
that when you select a file, the OK button is enabled and I have
not been
able to find a hook or delegate method that will allow me to
override this
behavior. I tried observing for changes to _nameField, to see if
maybe I
could set the enabled state for the button there, but my method is not
called even though the delegate is set.
What about finding the NSButton view in the dialog window (search
for the
view title “OK”), replacing it with my own subclass of NSButton to
override
setEnable to include the additional criteria?
The other thing is that I’m referencing the _okButton and
_nameField outlets
in NSSavePanel that do not have accessors, so I get the warning
about that
being a hard error in the future, which makes me nervous.
Has anyone needed to solve this problem, and if so how did you do it?
_______________________________________________
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