discuss-gnustep
[Top][All Lists]
Advanced

[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:44:28 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Hello i'm back :o)

Xavier Glattard <xavier.glattard <at> online.fr> writes:

> Andreas Höschler <ahoesch <at> smartsoft.de> writes:
> 
> > >> The TextField is validated in textDidEndEditing:
> > >> IMO its not a bug 
> > >> (see Cocoa reference)
> > (...)
> > 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.
> 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 
> extractingand returning the value. -textDidChange doesnt.
> 
> IMHO the bug is in NSNumberFormatter. I did have problem with this class.

Please forget this.

-validateEditing is invoked by NSActionCell in any -*Value method but
-objectValue ! So [NSCell -objectValue] is invoked that does not validate
the field.

I suggest either adding -objectValue to NSActionCell or move the
-validateEditing calls to NSControl. The later conforms better to the specs
but there might be a good reason to validate in NSActionCell...









reply via email to

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