Re: Recreating XCode run log behavior in an NSTextView
Re: Recreating XCode run log behavior in an NSTextView
- Subject: Re: Recreating XCode run log behavior in an NSTextView
- From: Paul Goracke <email@hidden>
- Date: Tue, 18 Sep 2007 11:24:46 -0700
Ken Tozier wrote:
Thanks for the link Paul
I added the willChange/didChange lines, and retried binding
directoy to the "log" method of my Appcontroller and when that
failed, adding an NSObjectController control-dragging from the
controller to the AppController, added a "log" key under attributes
set the Object class name of the object controller to NSDictionary
(also tried NSMUtableDictionary and AppController) and bound the
text view to the "log" key in the controller. No luck.
What am I missing here? This seems like it should be a piece of
cake. The entire UI consists of one window with an one NSTextView
that I want to display the "log" mutable string AppController
property.
My suggestion was mostly of the "is it plugged in?" variety.
Experimenting w/ your code now, I too see it not updating. On the
other hand, removing your setLog: method and adding
- (void) appendToLog: (NSString *) inString {
[self setValue:[NSString stringWithFormat:@"%@%@\n", log, inString]
forKey:@"log"];
}
seems to work. From this, I would conclude that the standard KVO (at
least for NSTextView value) responds to changes _of_ the object, not
necessarily changes _to_ the object. I think this conclusion is
supported by the observation that disabling automatic notifications
for 'log' and doing willChangeValueForKey, append, and
didChangeValueForKey also shows no update. This repeated copying of
strings is probably not optimal in your case--you may want to look at
using NSAttributedString and see if the attributedString binding is
better supported.
pg
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden