NSPDFImageRep vs. NSProgressIndicator
NSPDFImageRep vs. NSProgressIndicator
- Subject: NSPDFImageRep vs. NSProgressIndicator
- From: m <email@hidden>
- Date: Sat, 30 Nov 2002 20:41:04 +0000
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@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.