• 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
TextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TextView


  • Subject: TextView
  • From: Mai Bui <email@hidden>
  • Date: Fri, 15 Sep 2006 14:11:00 -0700

Hi All,

I search in Cocoa forum and cocoa documents but I could not find any solution to solve a problem in my software.

Basicly, I use NSTask to launch another my application (called Aapp). What ever Aapp use printf(), it will print out in my TextView window in my cocoa app.

Because App has multiple threads. One of threads use usleep(), it seems this one effect the speed of the text display in TextView. For example, if I use usleep(50000), it display (the whole buffer) every 16~17sec. If I use usleep(1000), it will display continously. If it sleep 1 sec, it take vevy long to display the stream. It seems to wait for the buffer to fill up before printout. Is there any way to set for the buffer not need to fill up so it can print it out continously?

My printLog routine like this:

- (void)PrintLog:(NSFileHandle *)handle
{
NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
NSData *data;
while ([data=[handle availableData] length]) {
NSString *logTxt=[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
NSRange theEnd = NSMakeRange([[outText string] length],0);
[outText replaceCharactersInRange:theEnd withString:logTxt];
theEnd.location += [logTxt length];
[outText scrollRangeToVisible:theEnd]; // scrolling to the end.
[logTxt release];
}
[pool release];
}


Thanks for any idea.
Mai.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Mail.app outline view font
  • Next by Date: Re: Mail.app outline view font
  • Previous by thread: Core graphics doesn't work with AppKit drawing (on PowerBook)
  • Next by thread: Image in place of NSTableColumn header cell
  • Index(es):
    • Date
    • Thread