• 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: NSAlert with NSTimer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAlert with NSTimer


  • Subject: Re: NSAlert with NSTimer
  • From: Sherm Pendley <email@hidden>
  • Date: Tue, 9 Dec 2008 05:16:14 -0500

The +scheduledTimer* methods schedule the timer using the default runloop mode. Try creating a timer without scheduling it, then adding it yourself to the current runloop with NSRunLoop's -addTimer:forMode: instead, using the NSModalPanelRunLoopMode mode:

    myTimer = [NSTimer timerWithTimeInterval:1.0
                       target:self
                       selector:@selector(killWindow:)
                       userInfo:nil
                       repeats:NO];

    [[NSRunLoop currentRunLoop] addTimer:myTimer
                                forMode:NSModalPanelRunLoopMode];

sherm--

On Dec 9, 2008, at 4:59 AM, Rashmi Vyshnavi wrote:

I am using NSAlert. When runModal is called on the NSAlert's object, timer
is not fired till the time i close the alert panel..


On Tue, Dec 9, 2008 at 3:20 PM, rajesh <email@hidden> wrote:

I did something like this , long time back

hope, this is close enough to your requirement  or may be its a wrong
practice ( user discretion required :) )

-()runAlert
{
..// show modal window
NSTimer *myTimer = [[NSTimer scheduledTimerWithTimeInterval:someTime
target:self selector:@selector(killwindow:) userInfo:nil repeats:No];
}

-() killwindow:(NSTimer *) theTimer
{
//kill the window
}


if the user click on the alert window then "– invalidate" the myTimer


This worked for me

~Rajesh

On Dec 9, 2008, at 10:37 AM, Rashmi Vyshnavi wrote:

Hi,
I want to close a Modal NSAlertPanel after specific period of time if user
does not click on any of the buttons. Is there a way to set up a NSTimer to
close the Alert Panel after 10 secs.


--
Thanks..
_______________________________________________

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:
@vangennep.nl


This email sent to email@hidden





--
Rashmi Vyshnavi
_______________________________________________

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

_______________________________________________

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


  • Follow-Ups:
    • Re: NSAlert with NSTimer
      • From: "Rashmi Vyshnavi" <email@hidden>
References: 
 >NSAlert with NSTimer (From: "Rashmi Vyshnavi" <email@hidden>)
 >Re: NSAlert with NSTimer (From: rajesh <email@hidden>)
 >Re: NSAlert with NSTimer (From: "Rashmi Vyshnavi" <email@hidden>)

  • Prev by Date: Re: NSAlert with NSTimer
  • Next by Date: Re: NSAlert with NSTimer
  • Previous by thread: Re: NSAlert with NSTimer
  • Next by thread: Re: NSAlert with NSTimer
  • Index(es):
    • Date
    • Thread