• 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
Undo in formatted text fields
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Undo in formatted text fields


  • Subject: Undo in formatted text fields
  • From: Bill Cheeseman <email@hidden>
  • Date: Fri, 10 Aug 2001 17:05:45 -0400

I can turn on "Undo Typing"/"Redo Typing" in all of a window's text fields
and form cells at once using this statement in my window controller's
windowDidLoad method:

[(NSTextView *)[[self window] fieldEditor:YES forObject:nil]
setAllowsUndo:YES]

As near as I can tell from the sparse documentation, that's the right way to
do it. But I'm not entirely sure. Two questions:

1. Is there a cleaner way to access my window's field editor?

Using a cast seems awkward.

2. How do I make Cocoa's text view Undo/Redo routines honor a custom
on-the-fly formatter attached to one or more text fields?

My custom on-the-fly formatter is ignored when I choose Undo Typing or Redo
Typing in a field with the formatter attached. The formatter's
isPartialStringValid:... Method never gets invoked. This results in bizarre
character strings in the text field.

3. Is there a way to turn on text view Undo/Redo on a text field-by-text
field basis?

The controlTextDidBeginEditing: delegate method and equivalents don't work
for this purpose, because they only turn on Undo/Redo after the first
character was typed in a text field, so they undo incorrectly (failing to
change the first character).

--

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: Cocoa downgrade from openstep?
  • Next by Date: Re: Memory Management
  • Previous by thread: Re: Where is documentation on AuthorizationCreate, etc.?
  • Next by thread: NSUserDefaults
  • Index(es):
    • Date
    • Thread