Re: PDFDocument and CGPDFDocument
Re: PDFDocument and CGPDFDocument
- Subject: Re: PDFDocument and CGPDFDocument
- From: Graham Cox <email@hidden>
- Date: Wed, 11 May 2011 23:36:15 +1000
On 11/05/2011, at 10:34 PM, Graham Cox wrote:
> On a follow-up note, I'm using PDFView and PDFThumbView in a modal dialog to pick the page to open (since it's part of opening a file I don't yet have a document to hang a sheet from). The main page view works fine but I notice that the thumbnail images apart from the first don't get updated during the modal dialog, only when the modal session ends. If I run the window modelessly it works normally. Anyone know anything about this, and how to fix it? I'd guess that some timer is used to update the thumbs and it's not being run in the modal loop mode.
I found a hack that does get this to work, but as it involves "kicking" the run loop during a modal session, I dunno if it's really legal.
Trying to force the thumb view to display in the modal session doesn't work, so my guess is that a timer is used to fetch the the page to be rendered as a thumbnail and that's what's blocking, not the repaint. This code in the modal dialog's window controller.
NSModalSession session = [NSApp beginModalSessionForWindow:[self window]];
NSInteger result;
while( 1 )
{
result = [NSApp runModalSession:session];
if( result != NSRunContinuesResponse )
break;
// force run loop to run in standard mode so that thumbs get updated:
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate date]];
}
[NSApp endModalSession:session];
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden