Q: Why doesn't my NSProgressIndicator redraw every time I update it's value?A: When an update to NSProgressIndicator is needed, when its value changes, or you call animate: , an event to redraw the view is added to the event queue and will be processed the next time events for that view are dispatched. To ensure the progress bar redraws at once, you need to call: [progressIndicator displayIfNeeded];
This will force pending events out of the standard queue and have them reflected on-screen immediately. Listing 1: Example of using NSProgressIndicator control in a loop.
[progressIndicator setMaxValue: (double)count];
//...
for (loopIndex = 0; loopIndex < count; loopIndex++)
{
// do some work...
[progressIndicator setDoubleValue: (double)loopIndex];
[progressIndicator displayIfNeeded];
}
Document Revision HistoryDate | Notes |
---|
2006-11-15 | First Version |
Posted: 2006-11-15
|