• 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
NSFormatter bug (workaround)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFormatter bug (workaround)


  • Subject: NSFormatter bug (workaround)
  • From: Bill Cheeseman <email@hidden>
  • Date: Tue, 07 Aug 2001 08:59:09 -0400

Sorry to keep harping on this, but I found a workaround for the insertion
point bug when overriding the new, long form of isPartialStringValid:... in
NSFormatter.

At the end of my override of that method, before returning YES or NO, I
insert this:

if ([*partialStringPtr length] == 0) {
[[[NSApp keyWindow] fieldEditor:NO forObject:nil]
setSelectedRange:*proposedSelRangePtr];
}

The fact that this completely solves the disappearing insertion point
problem pretty much proves that there is a bug somewhere in Cocoa in
connection with the isPartialStringValid:... method in the case when the
*partialStringPtr parameter holds a zero-length string, doesn't it?

I believe it is safe to access the current field editor in this way from a
formatter, since the fact that a formatter is running guarantees that my
text field's window is the key window and that the key window's field editor
is currently in use by my text field. Or am I overlooking something?

--

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

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


  • Prev by Date: Re: Pop-Up Tabs and the Quest for a File Viewer
  • Next by Date: Re: Autorelease pool - was Beginners question regarding NSFileHandle
  • Previous by thread: Re: Autorelease pool - was Beginners question regarding NSFileHandle
  • Next by thread: Retained items and autorelease pool
  • Index(es):
    • Date
    • Thread