On Nov 6, 2009, at 5:08 PM, Stephen J. Butler wrote:

On Fri, Nov 6, 2009 at 3:50 PM, Dalton Hamilton <dal...@me.com> wrote:

Well, from the code you've shown us, you call "[outHandle
readDataToEndOfFile]". Which means it waits for all the data before
updating the view. So yes, the view will be empty until the tool is
complete because that's what you told it to do.


I meant it should update the NSTextView each time a task is called. It was waiting until the runCommand was called 30 times and everything was done and then suddenly all the text would showup in the NSTextView. It should have blocked until the task was over for each log file, then updated the TextView for each entry of runCommand method and new task.

If you want to update as the tool outputs stuff, you need to
readInBackgroundAndNotify and run the runloop. You can do all this
without threads...

I like this idea and have been working on this since I received your email.
I'm having two problems now:

Two problems.
1. The first problem is that when I enter runCommand with sequentially each time asking it to parse a new log file, the python script produces output text but not all the output from the Python script makes it to the NSTextView. The output (or text inside the NSTextView) isn't complete for each log file and this seems random. This is why, when you look at my code, you'll see a final read after the [task waitUntilExit] and that doesn't solve the problem really. 2. The second problem is the application hangs using this method. If I don't use the readInBackgroundAndNotify and simply use NSThread and performSelectorOnMainThread it never hangs and I get full text output.

Here is small piece of my code:
http://web.me.com/dalton/Cocoa_Notes/NSTextView_NSThread.html


Thanks a lot.
Dalton Hamilton

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to