[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCell bug

From: Xavier Glattard
Subject: Re: NSCell bug
Date: Wed, 28 Feb 2007 10:12:52 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Andreas Höschler <ahoesch <at> smartsoft.de> writes:

> >> The TextField is validated in textDidEndEditing:
> >> IMO its not a bug 
> >> (see Cocoa reference)
> >>
> >> You should catch NSControlTextDidEndEditingNotification instead of
> >> NSControlTextDidChangeNotification
> >>
> >
> > I second this opinion. Still it is strange why your code worked
> > correctly on Cocoa.
> I haven't read the spec. But even without having done so I would say 
> that posting a textDidChange notification is not of much use if the 
> delegate method is not able to figure out to what the value had been 
> changed. I don't know whether Apple is calling validateEditing, but 
> they definitely make sure that objectValue reflects the changes made 
> before this notification is posted.
> Regards,
>    Andreas

I dont have a Mac. But that make sense to me that the field was validated
only when the edition ends. Before that the returned object would be nil 
most of the time. That's ok for a simple number but not for a more complex
object like a Date or Time.
I dont know what you need to do with the value of the field but the following
should always work :
[[valueField currentEditor] string]

Anyway you're right : your code should work. I found out in the Cocoa specs that
the -*Value methods must invokes the -validateEditing method before extracting
and returning the value. -textDidChange doesnt.

IMHO the bug is in NSNumberFormatter. I did have problem with this class.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]