Re: Delegate for multiple NSTextViews
Re: Delegate for multiple NSTextViews
- Subject: Re: Delegate for multiple NSTextViews
- From: Glenn Andreas <email@hidden>
- Date: Wed, 14 Apr 2004 16:28:19 -0500
At 4:01 PM -0500 4/14/04, Rob Minerick wrote:
Hi everyone,
What I have is multiple views of a single NSTextStorage and
each view has a delegate. The problem I'm having is that only the
first text view I create actually calls the delegate when I make a
change in the view. The other views never call their delegate.
[snip]
Does anyone have an explanation as to why the delegate is called
when singleTextView is edited, but not for textView? Any ideas would
be good, I'm at my wits end with this one.
I'm guessing it is "by design". After all, how else would
"textView:shouldChangeTextInRange:replacementString:" work if there
were multiple delegates that had to be queried? Would it ask all of
them, and if any of them said "yes" it would change them? Or if any
of them said "no" it wouldn't? Personally I would have guessed that
it would use whatever is the key view's delegate, but that would just
have been a guess.
If you want multiple things to respond to a change in a single other
thing, I'd use notifications (since that is an inheritently
one-to-many sort of thing). You obviously aren't going to get the
same sort of interaction that a delegate would get, but depending on
what you are doing, it may be enough.
--
Glenn Andreas email@hidden
mondo blobbo, Cythera, Theldrow, oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
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.