[Top][All Lists]

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

Re: NSCell bug

From: Andreas Höschler
Subject: Re: NSCell bug
Date: Wed, 28 Feb 2007 23:18:26 +0100

Hello Xavier,

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.



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.

Yes, I wondered about that as well. However, there probably will be much more number fileds in the average app than fields with more complex qualifiers. And for these fields it might be important to know the current contents even before editing ends.

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.

OK, so ...



reply via email to

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