Re: Problem with updating NSProgressIndicator
Re: Problem with updating NSProgressIndicator
- Subject: Re: Problem with updating NSProgressIndicator
- From: j o a r <email@hidden>
- Date: Tue, 20 May 2008 08:11:40 -0700
On May 19, 2008, at 11:53 PM, Vitaly Ovchinnikov wrote:
I tried to move progress update from timer to selector that was called
by performSelectorFromMainThread - doesn't help too.
Does this comment mean that you're currently calling -setDoubleValue:
from a background thread? That's, AFAIK, not supported. You need to
change this, and any other calls that you do on UI components, to the
main thread. This is likely the source of your problems.
Verify that your background threads never make any thread unsafe
calls, and use -performSelectorOnMainThread: to forward your status
updates to the main thread for display.
If you still have this problem, I think that the next step would be
for you to create a small sample project that reproduces the problem
and then sending a link to the list so that we can check it out.
On May 20, 2008, at 6:40 AM, Matt Long wrote:
I recently wrote a blog post with a demo xcode project that shows an
implementation of updating a progress indicator for file copy. You
can see it here: http://www.cimgf.com/2008/05/03/cocoa-tutorial-file-copy-with-progress-indicator/
Two things:
* The "context" pointer of your callback function is designed to allow
you to pass information about the object that is interested in the
callback. In that way you don't have to do things like creating a
separate static variable for the progress indicator. I find this to be
a "cleaner", or at least more object oriented, solution.
* If you're not blocking the main thread you don't have to call -
displayIfNeeded. The "if needed" part probably doesn't make much sense
here in any case - You know that it's needed, you just updated the
value. If you need to force display you should call -display, but you
should only have to do this in exceptional situations. It is much more
common to flag a control as needing to update display, in which case
you would call -setNeedsDisplay:. In this case though, you shouldn't
have to do either, as the call to -setDoubleValue: will flag the
control as needing display.
j o a r
_______________________________________________
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