Validation and NSUserDefaultsController
Validation and NSUserDefaultsController
- Subject: Validation and NSUserDefaultsController
- From: David Webster <email@hidden>
- Date: Fri, 5 Dec 2003 21:56:40 +0000
I hope someone can shed some light on this as I could not find anything
in the docs or mamasam.
I have a text field on my preferences panel, a browse button next to it
and have hooked the text field up - binding to the shared user
defaults. The text field takes a path of a default data directory.
When browsing, the string is always OK but as I want to allow editing
of the text field as well, invalid entries can be entered. I have
everything hooked up and it works fine, except that I would like to
catch typed in, invalid entries, so they are not stored in the
NSUserDefaults and also raise a warning dialog.
If using the other controllers I know I can validate using
validate<Key>:error: in the model as they of course would be KVC
compliant but how do I validate when using the NSUserDefaultsController
as I cannot use the validate<Key>:error: approach on the
NSUserDefaults.
I have thought of a few approaches but none seem suitable i.e. using a
NSValueTransformer, NSFormatter or even going back to including
target/action and re-setting the text field and NSUserDefaults etc...
The last is most promising but still seems like a kludge given that I
am trying to use the new controller layer and bindings.
Can anyone point me in the right direction?
Thanks
David Webster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.