Re: running a timer while displaying a sheet
Re: running a timer while displaying a sheet
- Subject: Re: running a timer while displaying a sheet
- From: Ken Thomases <email@hidden>
- Date: Sat, 16 Oct 2010 08:47:45 -0500
On Oct 16, 2010, at 6:29 AM, Nick Rogers wrote:
> When I run a sheet, I want it to display a text field which has to be updated every second or so (basically showing a count down "60 Seconds", "59 Seconds" and so on.
> I am starting a timer in main thread using:
> timerRawScanMsg = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(myTimerFireMethod:) userInfo:nil repeats:YES];
> [[NSRunLoop currentRunLoop] addTimer:timerRawScanMsg forMode:NSModalPanelRunLoopMode];
> [[NSRunLoop currentRunLoop] addTimer:timerRawScanMsg forMode:NSEventTrackingRunLoopMode];
> Then I'm starting the sheet using:
> [NSApp beginSheet:windowRawScanMsg modalForWindow:windowMain modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:nil];
>
> The myTimerFireMethod: is not getting called, which would update the text field in the sheet.
Sheets are document-modal, but are not modal windows or panels. They are not processed by a modal run loop. The run loop runs normally when a sheet is up. Try NSDefaultRunLoopMode.
Regards,
Ken
_______________________________________________
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