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: "Ashish Tiwari" <email@hidden>
- Date: Tue, 18 Sep 2007 11:56:34 +0530
I used IBOutlets...
As per my understanding Textview should be updated by main thread, are you
doing so?
-----Original Message-----
From: cocoa-dev-bounces+ashish_tiwari=email@hidden
[mailto:cocoa-dev-bounces+ashish_tiwari=email@hidden] On
Behalf Of Ken Tozier
Sent: Tuesday, September 18, 2007 11:39 AM
To: Cocoa Dev Dev
Subject: Re: Recreating XCode run log behavior in an NSTextView
Hi Ashish
How is that connected up in IB? Are you using bindings or IBOutlets?
If bindings, could you flesh in the details a bit more on how the
text view is bound to the model object?
Thanks
Ken
On Sep 18, 2007, at 2:04 AM, Ashish Tiwari wrote:
> Hi Ken,
> Following code gives my application the same behavior as you need..
>
> -(void) printTextOnLoggingTextView:(NSString *) senderText
> {
> if (senderText)
> {
> NSRange range = NSMakeRange([[m_loggingTextView textStorage]
> length],0);
> [m_loggingTextView replaceCharactersInRange:range
> withString:senderText];
> [m_loggingTextView scrollRangeToVisible:range];
> [m_loggingTextView display];
> }
> }
>
> Hope it helps you...
>
> Ashish
>
> -----Original Message-----
> From: cocoa-dev-bounces+ashish_tiwari=email@hidden
> [mailto:cocoa-dev-bounces
> +ashish_tiwari=email@hidden] On
> Behalf Of Ken Tozier
> Sent: Tuesday, September 18, 2007 11:15 AM
> To: Cocoa Dev Dev
> Subject: Recreating XCode run log behavior in an NSTextView
>
> 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:
> 40persistent.
> co.in
>
> 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:
co.in
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