In article <abz-0908031757460001192.168.1.3>, Alain Birtz
You should try to do this with a formatter, if possible. If you just> The action for the OK button check if the editable NSTextField
> hold valid date.
need to ensure that the date the user entered is properly formatted, an
NSDateFormatter will do this for you automatically and even allow
natural-language entry (like "today" and "Friday").
If you need to do something more complicated like validate a date
range, then what you're doing now is probably an acceptable solution.
(It'd be better though not to let the user enter out-of-range dates to
begin with, but that is more complex to code.)
You should be using -[NSWindow makeFirstResponder:] instead, since the> For error the faulty NSTextField is set to
> first responder with becomeFirstResponder.
first responder is really a property of the window. The doentation
for -[NSResponder becomeFirstResponder] says this quite explicitly.
("Never invoke this method directly.")
-[NSWindow makeFirstResponder:] ensures that the current first
responder is resigned, if possible, and that the responder is changed,
if possible, and will return NO if for some reason it's not possible.
Chris Hanson, bDistributed.com, Inc. | Email: [email]cmhbDistributed.com[/email]
Custom Application Development | Phone: +1-847-372-3955
[url]http://bdistributed.com/[/url] | Fax: +1-847-589-3738
[url]http://bdistributed.com/Articles/[/url] | Personal Email: [email]cmhmac.com[/email]