• 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: Recreating XCode run log behavior in an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recreating XCode run log behavior in an NSTextView


  • Subject: Re: Recreating XCode run log behavior in an NSTextView
  • From: Ken Tozier <email@hidden>
  • Date: Tue, 18 Sep 2007 12:34:07 -0400

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.


On Sep 18, 2007, at 10:54 AM, Paul Goracke wrote:

Bindings use KVO and you're not notifying the observer of changes. Try changing your setter to

- (void) setLog:(NSString *) inString
{
	[self willChangeValueForKey:@"log"];
	[log appendString: [inString stringByAppendingString: @"\n"]];
	[self didChangeValueForKey:@"log"];
}

<http://developer.apple.com/documentation/Cocoa/Conceptual/ KeyValueObserving/index.html#//apple_ref/doc/uid/10000177i>

pg


On Sep 17, 2007, at 10:45 PM, Ken Tozier wrote:

Hi

I wrote a small folder scanning application to perform "deep watches" on changes to specified folders and their subfolders on a Windows server and wanted to present a simple "Run Log" like window so admins could see what the app is doing and spot any potential errors.

I created a window, added an NSTextView, unchecked all options in the "attributes" panel except "selectable" and "uses find panel", created the following accessors to a mutable string property called "log" in my AppController class

- (NSString *) log
{
	return log;
}

- (void) setLog:(NSString *) inString
{
	[log appendString: [inString stringByAppendingString: @"\n"]];
}

After that, I opened the bindings pane for the NSTextView, and set the following "value" bindings

Bind to: AppController
Controller key: <grayed out>
Model key path: log

Unchecked all checkboxes except

Continuously updates value
Raises for non applicable keys

When I run the app, it runs fins and the Xcode run log shows that it's doing it's thing but nothing appears in the text view.

When that didn't work, tried adding an NSObjectController, click- dragged a connection from the NSObjectController to the instantiated AppController and clicked "connect" on the "content field. Next, I defined a field called "log" in the controller, and bound the NSTextView value to that but that didn't work either.

Anyone see what I'm doing wrong?

Thanks for any help

Ken
_______________________________________________

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


_______________________________________________

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


  • Follow-Ups:
    • Re: Recreating XCode run log behavior in an NSTextView
      • From: Paul Goracke <email@hidden>
References: 
 >Recreating XCode run log behavior in an NSTextView (From: Ken Tozier <email@hidden>)
 >Re: Recreating XCode run log behavior in an NSTextView (From: Paul Goracke <email@hidden>)

  • Prev by Date: Re: CoreData Indexing is it possible?
  • Next by Date: Re: how to get objects of type Class to play with NSCoder?
  • Previous by thread: Re: Recreating XCode run log behavior in an NSTextView
  • Next by thread: Re: Recreating XCode run log behavior in an NSTextView
  • Index(es):
    • Date
    • Thread