On Mar 11, 2010, at 06:50, cocoa learner wrote:

> And on this custom view I have a progress bar, that progressbar gets it's
> progress value from a NSThread. And I am using following function render the
> progressbar, from NSThread -
> 
> 
> [progBar performSelectorOnMainThread: (display) withObject: nil
> waitUntilDone: YES];

There seem to be two things wrong here.

First, you must *not* set the value of the progress bar from a non-main thread. 
Setting the value causes a UI update, and that won't work properly unless it's 
done on the main thread. Instead, you must devise a method for the background 
thread to pass the desired value to the main thread, and have the main thread 
set the progress bar value.

Second, it's rarely correct to invoke [NSView display] yourself. Typically, you 
would use [NSView setNeedsDisplay].

In any case, it's not clear why you think you need to cause the progress bar to 
redisplay. If you set the value properly from the main thread, it will 
redisplay itself as necessary. If you're having a problem with the animation 
not running, you just need to make sure you set (or re-set) the value often 
enough.


_______________________________________________

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