Skip navigation.
 
mlNSPDFImageRep vs. NSProgressIndicator
FROM : m
DATE : Sat Nov 30 21:41:04 2002

Hi, I'm a newbie to Cocoa.

I've got a multipage pdf that I'm displaying in window using an
NSImageView (using an NSPDFImageRep instance). When I load the pdf,
there a delay before the pdf is displayed that is long enough to make
you think something's amiss, but not long enough for the busy cursor to
come up. A suboptimal user experience I'd like to avoid.

So I thought I'd put a NSProgressIndicator in the  window to which I'd
send a startAnimating message just before displaying the pdf and a
stopAnimating message afterwards. But it seems that there is something
within the pdf rendering machinery that stops progress indicators cold.
To prove this to myself, I wrote a small test app that starts the
progress indicator spinning in a controller object's awakeFromNib
method. Then I load the pdf.

To wit:

- (void)awakeFromNib
{
   [_spinner setUsesThreadedAnimation:YES];
   [_spinner startAnimation:self];
}

- (IBAction)loadPDF:(id)sender
{
   // attempt to load a new pdf
   NSImage* pdfImage = [[NSImage alloc]
initByReferencingFile:@"some.pdf"];    
   if (pdfImage && [pdfImage isValid])
   {
       [pdfImage retain];
       [_imageView setImage: pdfImage];
       [_imageView display];                    // <- spinner stops spinning here
   }
}

The progress indicator grinds to a halt for the duration of the
[_imageView display] call. Seems wrong to me.

The thing is, no matter what I do, the NSProgressIndicator stops
animating while the pdf is being imaged.

As you can see from my awakefromNib method, I have tried the [_spinner
setUsesThreadedAnimation:YES] trick, and it doesn't work.

I had a feeling that this could be due to the NSView locking focus for
the duration of the display method. So I tried putting a second
progress indicator in a second window by itself. Same thing, ergo, I
don't think its a locked focus thing (I could be talked out of it
though).

Any explanations or tips on how to get around this?

cheers,

_murat
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlNSPDFImageRep vs. NSProgressIndicator m Nov 30, 21:41
mlRe: NSPDFImageRep vs. NSProgressIndicator Robert Cerny Dec 2, 12:33
mlRe: NSPDFImageRep vs. NSProgressIndicator m Dec 2, 13:27
mlRe: NSPDFImageRep vs. NSProgressIndicator Robert Cerny Dec 2, 16:04