Re: NSTimer fires after invalidated - why?
Re: NSTimer fires after invalidated - why?
- Subject: Re: NSTimer fires after invalidated - why?
- From: Shaun Wexler <email@hidden>
- Date: Thu, 23 Mar 2006 01:30:14 -0800
On Mar 22, 2006, at 8:19 PM, Walt Horat wrote:
If a particular drawer is concealed when the user types, we want to
open the
drawer and have it close after a period of time; each keystroke
shall reset
the timer.
- (void)keyDown:(NSEvent *)event
{
if (!m_drawerCloseTimer) {
m_drawerCloseTimer = [[NSTimer
scheduledTimerWithTimeInterval:5.0 target:self selector:@selector
(keyTimer:) userInfo:nil repeats:YES] retain];
[m_drawer open];
} else {
[m_drawerCloseTimer setFireDate:[NSDate
dateWithTimeIntervalSinceNow:5.0]];
}
}
- (void)keyTimer:(NSTimer *)timer
{
if (m_drawerCloseTimer == timer) {
m_drawerCloseTimer = nil;
[timer invalidate];
[timer release];
[m_drawer close];
}
}
--
Shaun Wexler
MacFOH
http://www.macfoh.com
"Things should be described as simply as possible, but no simpler." -
Albert Einstein
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden