• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Bindings making NSNumberFormatter strange
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Bindings making NSNumberFormatter strange


  • Subject: RE: Bindings making NSNumberFormatter strange
  • From: Lee Ann Rucker <email@hidden>
  • Date: Thu, 23 Apr 2009 22:22:06 -0700
  • Acceptlanguage: en-US
  • Thread-topic: Bindings making NSNumberFormatter strange

________________________________________
From: Keary Suska [email@hidden]
Sent: Thursday, April 23, 2009 2:04 PM
To: Lee Ann Rucker
Cc: Cocoa-Dev (Apple)
Subject: Re: Bindings making NSNumberFormatter strange

On Apr 23, 2009, at 2:25 PM, Lee Ann Rucker wrote:

>> It is not your only choice, but it is probably the best choice.
>> Another poster suggested using isPartialStrignValid of the formatter,
>> but I have tried this in the past and run into undo issues,
>> particularly when using it to "filter" input. The problem is that
>> undo
>> registration happens before the validation call, and somehow the
>> "undo
>> typing" feature remembers the string, so when you change the string
>> in
>> the validator method, and then undo, you can get add results and out-
>> of-bounds exceptions. Since then I haven't looked into why this
>> happens and how to get around it, if at all possible.
>
>
> There's no workaround. I tried writing my own Undo handler, but as
> you've discovered the changes happen before there's a chance to
> handle them.
>
> Formatters work, and bindings work, but the combination doesn't. The
> only solution I've found is to use a formatter without bindings,
> since having the formatter is more important than having bindings,
> useful as they may be.

Just to be clear, are you saying that you can do field filtering with
a formatter, with appropriate undo support, without bindings, or are
you making a general remark about difficulties when using bindings
with formatters?

----
Two separate issues, both related to the fact that formatters that do filtering just aren't very robust.

I never got undo to work with a formatter, with or without bindings; we ended up disabling it because it behaved so badly.  For example, if you type two characters but one gets filtered out so there's only one left in the field, then try to undo, it tries to remove two characters and gives you a range error. It ought to be simple to fix, but too much of the action happens before developer code has a chance to intercept it.

Bindings + formatters had the problem I mentioned farther down, but at least the users don't notice if you don't have bindings._______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Bindings making NSNumberFormatter strange (From: Ulai Beekam <email@hidden>)
 >RE: Bindings making NSNumberFormatter strange (From: Ulai Beekam <email@hidden>)
 >Re: Bindings making NSNumberFormatter strange (From: Keary Suska <email@hidden>)
 >RE: Bindings making NSNumberFormatter strange (From: Ulai Beekam <email@hidden>)
 >Re: Bindings making NSNumberFormatter strange (From: Keary Suska <email@hidden>)
 >Re: Bindings making NSNumberFormatter strange (From: Lee Ann Rucker <email@hidden>)
 >Re: Bindings making NSNumberFormatter strange (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Dividing NSView to subviews
  • Next by Date: Re: CF autorelease?
  • Previous by thread: Re: Bindings making NSNumberFormatter strange
  • Next by thread: Combine multiple sources into an NSOutlineView using NSTreeController
  • Index(es):
    • Date
    • Thread