On Sep 28, 2011, at 4:26 PM, Quincey Morris wrote:

> On Sep 28, 2011, at 15:50 , Philip McIntosh wrote:
> 
>> I want the number in the display (which is a string representation of the 
>> number) to be formatted as it is entered not after any "return" or 
>> "calculate" keys are pressed. I can get it to format and display the string 
>> correctly "after" such a key is pressed, no problem.
> 
> I just went back and read as much of this thread as I could find (all of it, 
> I think) because I wasn't paying much attention earlier.
> 
> It seems to me you've created your own problem. You cannot re-create a string 
> that represents certain user-entered state [i.e. a partially-entered number] 
> if you run the input through a transformation that discards a vital piece of 
> the state. Converting a string to a number to a string [for a 
> partially-entered number] preserves *most* of the state, but not all of it, 
> because the numeric conversion you're using isn't intended for a 
> partially-entered number.
> 
> Specifically, if the user has typed "1.000" on the way to "1.0002", the 
> number to be converted is in fact 1.0002 even if partially entered. 
> Pretending temporarily that it's a fully-entered "1.000" throws away the part 
> of the state that represents partial completion, so the result is of course 
> "1.". That's what you asked for.
> 
> By replacing the partially user-entered string before the user has finished 
> entering it, you are already abusing the Cocoa text field metaphor to some 
> degree. 

I suspect you're also going to confuse the undo manager. I've had issues in the 
past when mixing it with formatters because the formatter changed the value 
that the text field was using but undo didn't notice, and then tried to undo 
more or less characters than were actually 
entered._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to