• 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: NSText textDidChange: doesn't report undo in text view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSText textDidChange: doesn't report undo in text view


  • Subject: Re: NSText textDidChange: doesn't report undo in text view
  • From: Charles Jolley <email@hidden>
  • Date: Sat, 6 Jul 2002 09:47:29 -0500

Hi Bill:

On Friday, July 5, 2002, at 01:49 PM, Bill Cheeseman wrote:

What's the workaround? Should I use NSTextStorage instead of my own text
data object. I not only need an up-to-date text data object, but I need to
be able to see my user's typing (and undoing) simultaneously in two separate
text views.

Unless you have some compelling reason to use your own text data object, you can simply connect two text views (actually, the two layout managers owned by two text views) to the same text storage and they will both reflect the same contents automatically. Basically, all you have to do is reconfigure the network of text objects created by the text views to do this. The Cocoa docs on the text system architecture explain this task pretty well, I think.

If you need to monitor changes to the text still, you can use notifications in the text storage to catch ANY changes to the text, regardless of the source of those changes.

If the user is going to be editing both text views, though, be sure to clear the selection (set to {0,0}) of a text view when it loses its first responder status. Since selections are managed by text views/layout managers, both text views will have independent selection states. If one text view has some text selected that the user deletes in the other text view, the text views will start generating exceptions and basically stop working.

Even if using NSTextStorage proves to be feasible, it seems to me that
NSTextView needs to be revised to override NSText's textDidChange: delegate
method, to pick up and report the undo and redo events. I wonder if this can
be done in a category on NSTextView? Should I put this on RadarWeb as a
bug/feature request?

Considering that the purpose of textDidChange: is to notify you of changes made by the user, undo/redo should be covered, I think. Filing a Bug/feature request is a great idea.

Cheers,
-Charles
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSText textDidChange: doesn't report undo in text view
      • From: Bill Cheeseman <email@hidden>
References: 
 >NSText textDidChange: doesn't report undo in text view (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: accessor generation???
  • Next by Date: cocoa docs search
  • Previous by thread: NSText textDidChange: doesn't report undo in text view
  • Next by thread: Re: NSText textDidChange: doesn't report undo in text view
  • Index(es):
    • Date
    • Thread