Re: Measuring time between keypresses?
Re: Measuring time between keypresses?
- Subject: Re: Measuring time between keypresses?
- From: Ken Thomases <email@hidden>
- Date: Tue, 31 Mar 2009 20:33:49 -0500
On Mar 31, 2009, at 8:27 PM, Debajit Adhikary wrote:
I'm trying to write an app where I need to accept keypresses, and call
a function whenever the user has stopped typing (or when there is a
specified delay between keystrokes).
How do I measure the time between two keystrokes?
Measuring the time between keystrokes (or events of any other kind) is
easy. Each keystroke generates an NSEvent and NSEvent has a -
timestamp method.
The real problem is that you want to do something when there _hasn't_
been an event for a certain time period. For that, I recommend that
you schedule an NSTimer, and keep pushing back its firing time each
time you get a keystroke.
Cheers,
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