Thanks Kyle - that's really helpful.

I hadn't read the subclassing notes because I'm not subclassing. My model stores attributed strings (pity there's not a - setAttributedString: method on NSTextView that would deal with all the kinks necessary). I'd also missed the discussion on this method because I didn't know I needed to be using it - why read it if you don't need it, and how do I know I need it unless something else says so? - a typical chicken-and-egg situation.

Anyway, hopefully this will fix the problem. Thanks again.

--Graham


On 07/10/2009, at 12:01 PM, Kyle Sluder wrote:

On Tue, Oct 6, 2009 at 5:53 PM, Graham Cox <[email protected]> wrote:
Aha! Thanks - can you point me to the relevant documentation on that? I was working on the principle that methods like this were high level and were
managing that before-and-after notification/setup stuff for me.

First Google result for "shouldchangetextinrange": Text Editing
Progamming Guide, Subclassing NSTextView, Notifying about Changes to
the Text. 
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/TextEditing/Tasks/Subclassing.html

Also in the documentation for
-shouldChangeTextInRange:replacementString: (but if you know to look
there you probably already know the solution).

This is something you need to check for whenever you might possibly
ever hook up a text view (including the field editor!) to a text
storage.  So if you're storing text storages in your model, for
example, like in a word processor.  This isn't going to show up if
you're just using -setString: (the typical case).

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to