Re: Deleting contents of NSTextView...
Re: Deleting contents of NSTextView...
- Subject: Re: Deleting contents of NSTextView...
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 02 Jul 2002 14:43:02 -0400
on 02-07-02 5:35 AM, Eric at email@hidden wrote:
>
I wonder if there is a better way. Having a separate data store as
>
the text view's model object seems to be superfluous when Apple has already
>
provided you with a model class, namely NSTextStorage. Also, repeatedly
>
calling -textDidChange: in order to sychronize the text view with it's data
>
store whenever the user changes the contents of the text view seems somewhat
>
inefficient to me.
I have exactly the same qualms, but I must say that doing it with a separate
model class and using textDidChange delegate method is very fast. I pasted
quite a large RTF file into my text view, then did some fast typing (100
wpm, at my best), cutting, pasting, dragging, font changing, etc., and it
didn't slow me down at all.
Other examples (Building Cocoa Applications, etc.) use another technique to
catch typed changes less often, then call a "synchronize" method. But I
don't see any point in optimizing for speed until I notice a problem, and I
don't yet.
>
Btw, Recipe 6 will be coming out soon, I hope :-)
I'm working on 16 [sic] right now. They'll be published as a Peachpit book
this fall. Total recipe count between 20 and 25.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
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.