AFAIU accessing UI elements from within an NSThread is a big no-no.

So in the following naive code I would have to either wrap the calls to the progressIndicator object through a performSelectorOnMainThread or could send NSNotifications to update it on the main thread. But looking around the net I haven't seen any example where either of both approaches is being used. Did I just not look at the right places?

I am also wondering whether using NSRunCriticalAlertPanel() in the thread is OK or not.

cheers
--
Torsten


[NSThread detachNewThreadSelector:@selector(convert)
                             toTarget:self
                           withObject:nil];

- (void) convert {

    [progressIndicator setMaxValue:10];
    [progressIndicator startAnimation:self];

        if (...) {
                NSRunCriticalAlertPanel(...);   
        }

    int i;
    for(i = 0; i < 10; i++) {
        [progressIndicator setDoubleValue:(double)i];
        [progressIndicator displayIfNeeded];
        ...
    }

    [progressIndicator stopAnimation:self];
}

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [EMAIL PROTECTED]

Reply via email to