Re: NSTextView
Re: NSTextView
- Subject: Re: NSTextView
- From: albert jordan <email@hidden>
- Date: Wed, 22 Sep 2010 10:43:07 -0700
Hi Martin,
THanks so much for the suggestion.
The approach improves the situation, but unfortunately does not resolve it. But understand now that this is the issue, I'm going to see if there will be another work around.
Thanks again.
Albert
On Sep 22, 2010, at 3:38 AM, Martin Hewitson wrote:
> Hi Albert,
>
> You might try appending the text directly to the text storage:
>
> NSMutableAttributedString *attstr = [[[NSMutableAttributedString alloc] initWithString:someText] autorelease];
> [[textView textStorage] beginEditing];
> [[textView textStorage] appendAttributedString:attstr];
> [[textView textStorage] endEditing];
>
> Cheers,
>
> Martin
>
> On Sep 22, 2010, at 4:03 AM, albert jordan wrote:
>
>> Greetings,
>>
>> I'm having a problem with NSTextView, and I'm wondering if anyone can help verify the source of the problem and suggest alternatives.
>>
>> I'm trying to develop an automated test program for Android handsets. I can connect two Android handsets to my MAC, and among other things, I would like to have customized windows for each device that will display logging information coming from the handset.
>>
>>
>> I have setup an "NSTextView in an NSScrollView" item in interface builder, and my window controller objects has an IBOutlet that is linked to TextView of the item (if I connect it to the NSScrollView, I don't get any text). Anytime that I get a log statement, I use the insert text method to print out the log line in the view...
>>
>> [myTextView insertText: (NSString *) newLogLine];
>>
>>
>> The problem is that this interface freezes. If I change the program so that every 100th log line is entered, then things work fine. Reading the NSTextView documentation I note the following for "insertText"...
>>
>> "This method is the entry point for inserting text typed by the user and is generally not suitable for other purposes."
>>
>> So my assumption is that insertText in TextView is not suited for cases where new strings are sent rapidly. Is this a correct interpretation? Is this anyone else's experience?
>>
>> Does anyone know a work around this? NSLog/Concole works fine, but since I have multiple devices I would like to break the log entries in two different windows.
>>
>> Thanks in advance.
>>
>> Regards,
>>
>> albert
>> _______________________________________________
>>
>> 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
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Martin Hewitson
> Albert-Einstein-Institut
> Max-Planck-Institut fuer
> Gravitationsphysik und Universitaet Hannover
> Callinstr. 38, 30167 Hannover, Germany
> Tel: +49-511-762-17121, Fax: +49-511-762-5861
> E-Mail: email@hidden
> WWW: http://www.aei.mpg.de/~hewitson
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
_______________________________________________
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