TextView
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