• 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
Bug in NSFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug in NSFormatter


  • Subject: Bug in NSFormatter
  • From: Bill Cheeseman <email@hidden>
  • Date: Sun, 15 Jul 2001 20:56:14 -0400

The new NSFormatter method --

isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRa
nge:errorDescription:

-- does not appear to handle the delete key and the forward delete key
correctly.

When I use the delete key to delete a character backwards,
origSelRange.location reports the location where the insertion point ends
up, one to the left of the actual original insertion point location.

Also, origSelRange.length reports an original selection length of 1 when no
character was actually selected. It correctly reports 1 (or more) when one
character (or more) was selected.

The forward delete key gets the original location correct, but it also
reports an original selection length of 1 when nothing was selected.

These problems arise in a custom formatter that makes use of this method's
ability to let you substitute edited text for the text the user typed. I
thought it might be possible that these bugs only arise when edited text
that differs in length from what the user typed has been inserted into the
field. But that seems unlikely, because normal typing of printable
characters yields correct values.

Needless to say, these bugs make it very hard to write a custom formatter
that handles backspace and forward delete correctly.

Can anybody confirm these bugs, or explain what I'm doing wrong? And can
somebody remind me of the Cocoa feedback email address? -- I can't find it
anywhere on Apple's web pages.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA

The AppleScript Sourcebook - www.AppleScriptSourcebook.com
Vermont Recipes - www.stepwise.com/Articles/VermontRecipes


  • Follow-Ups:
    • Re: Bug in NSFormatter
      • From: Tom Waters <email@hidden>
  • Prev by Date: Currency Converter sample [rateField selectText:self]; doesn't work...?
  • Next by Date: Something is definitely messed up.....
  • Previous by thread: Re: Currency Converter - NSTextField selectText: Works Sometimes! Bug?
  • Next by thread: Re: Bug in NSFormatter
  • Index(es):
    • Date
    • Thread