• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: running a timer while displaying a sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >running a timer while displaying a sheet (From: Nick Rogers <email@hidden>)

  • Prev by Date: Re: NSSavePanel does replace / in the filename with a :
  • Next by Date: Re: NSSavePanel does replace / in the filename with a :
  • Previous by thread: running a timer while displaying a sheet
  • Next by thread: Loading a Nib file
  • Index(es):
    • Date
    • Thread