• 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 & Undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFormatter & Undo


  • Subject: NSFormatter & Undo
  • From: Keary Suska <email@hidden>
  • Date: Wed, 12 Jul 2006 17:58:07 -0600
  • Thread-topic: NSFormatter & Undo

I have a custom NSFormatter that filters out unwanted characters and applies
a format on field exit. Everything works fine until I try to undo. The undo
is completely messed up if any "invalid" character is entered or a paste is
done that contains invalid characters. With multi-character pastes, I almost
invariably get:

-[NSBigMutableString substringWithRange:] called with out-of-bounds range.
For apps linked on Tiger this will raise an exception. For earlier apps it
will produce this one-time warning and continue with existing behavior
(which is undefined).
*** -[NSBigMutableString substringWithRange:]: Range or index out of bounds

My assumption is that only the pre-formatted edit is being registered with
the undo manager, and the programmatic changes are invalidating the undo
action.

If this is indeed the case, do I need to handle my own undo, or can I just
call -removeAllActions and -registerUndoWithTarget:selector:object: on the
current field editor's undo manager?

Thanks,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Getting added object with KVO
  • Next by Date: NSPasteboardPromiseTimeout question
  • Previous by thread: Re: How to perform a Coredata subquery
  • Next by thread: NSPasteboardPromiseTimeout question
  • Index(es):
    • Date
    • Thread