Disabling buttons in NSSavePanel
Disabling buttons in NSSavePanel
- Subject: Disabling buttons in NSSavePanel
- From: Michael Domino <email@hidden>
- Date: Mon, 29 Jun 2009 09:45:48 -0400
- Thread-topic: Disabling buttons in NSSavePanel
Hi,
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?
Thanks,
Michael
--
Michael Domino
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