On Aug 8, 2014, at 9:58 AM, Keary Suska <[email protected]> wrote:

> On Aug 7, 2014, at 10:23 PM, Daryle Walker <[email protected]> wrote:
> 
>> have a bar-style NSProgressIndicator that has its “Display When Stopped” 
>> turned off and (initially) Indeterminate turned on.  It (almost) properly 
>> updates when a load is going on:
>> 
>> //=====
>> - (void)notifyOnProgressStarted:(NSNotification *)notification  // 
>> WebViewProgressStartedNotification
>> {
>>   [self.loadingProgress startAnimation:self];
>> }
>> 
>> - (void)notifyOnProgressChanged:(NSNotification *)notification  // 
>> WebViewProgressEstimateChangedNotification
>> {
>>   [self.loadingProgress setIndeterminate:NO];
>>   [self.loadingProgress setDoubleValue:self.webView.estimatedProgress];
>> }
>> 
>> - (void)notifyOnProgressFinished:(NSNotification *)notification  // 
>> WebViewProgressFinishedNotification
>> {
>>   [self.loadingProgress stopAnimation:self];
>> }
>> //=====
>> 
>> However, the bar is still shown after the download finishes.  It goes away 
>> when I either turn off and back on the top content border it sits on or if I 
>> change the display status of the toolbar above it.  Changing the bar back to 
>> indeterminate (in the Finishing notification) makes no difference.
> 
> Is the progress indicator loaded from a xib, with your initial settings? If 
> so I would double-check the isDisplayedWhenStopped value at or after 
> awakeFromNib. If the value is still NO, IIRC there has been a long-standing 
> bug with NSProgressIndicator in certain views. Try calling 
> [[self.loadingProgress superview] setNeedsDisplay:YES] after you stop 
> animation. If that works, that will be confirmation that the bug still 
> stands...

The bug is there, but neither yours or Jerry’s solution works!  I’ve tried:

self.loadingProgress.needsDisplay = YES;
self.loadingProgress.superview.needsDisplay = YES;
[self.loadingProgress viewWillDraw];
[self.loadingProgress.superview viewWillDraw];
[self.loadingProgress updateLayer];
[self.loadingProgress.superview updateLayer];
NSRect const *  rects;
NSInteger  rect_count;
[self.loadingProgress getRectsBeingDrawn:&rects count:&rect_count];
for ( NSInteger i = 0 ; i < rect_count ; ++i ) {
    [self.loadingProgress drawRect:(rects[i])];
}
if (![self.loadingProgress isHidden]) {
    [self.loadingProgress setHidden:YES];
    [self.loadingProgress setHidden:NO];
}
[self.loadingProgress.superview setHidden:YES];
[self.loadingProgress.superview setHidden:NO];
[self.windowForSheet toggleToolbarShown:self];
[self.windowForSheet toggleToolbarShown:self];

It seems that the area is made “dirty” just fine, it’s just that the updating 
code doesn’t care unless something OUTSIDE the dirty rectangle forces a 
re-draw.  I tried the last code to do that, but it only works the first time.  
On subsequent reloads, the toolbar double toggle happens before the loading 
progress bar stops, so the redraw takes place too soon.  I think we need a 
bail-out from Apple.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

_______________________________________________

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

This email sent to [email protected]

Reply via email to