Ask Experts Questions for FREE Help!
Ask    ||    Answer
 
Advanced  
 

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > C   »   C++ Stop continued key press

 
Thread Tools Search this Thread Display Modes
Question
 
 
#1  
Old Sep 17, 2009, 11:13 AM
Ribbonic Plague's Avatar
Ribbonic Plague
New Member
Ribbonic Plague is offline
 
Join Date: May 2008
Posts: 19
Ribbonic Plague See this member's comment history on his/her Profile page.
C++ Stop continued key press

Hello everyone!

Just wondering if any of you know if there's a way to stop continued keypress?

For example, if I have something that increments int Counter by one everytime a key is pressed, if I press a key without actually lifting my finger, it shouldn't continue to increment. It should only increment once per press.

Thanks for your help!

Reply With Quote
 
     

Answers
 
 
Old Sep 17, 2009, 11:20 AM   #2  
Ultra Member
Perito is offline
 
Perito's Avatar
 
Join Date: Feb 2009
Location: USA
Posts: 2,880
Perito See this member's comment history on his/her Profile page.Perito See this member's comment history on his/her Profile page.
You can trap the key down and key up events. Once a Key Down has occurred, you can allow it to increment once, and prevent anything from incrementing a second time until the Key Up event has occurred. Just use a Boolean and set it in an IF block in the Key Down event. Then clear it in the Key Up event.

Comments on this post
Ribbonic Plague agrees: So fast and helpful. Let me see if I can get this to work with your suggestion...
  Reply With Quote
 
     
 
 
Old Sep 17, 2009, 11:23 AM   #3  
New Member
Ribbonic Plague is offline
 
Ribbonic Plague's Avatar
 
Join Date: May 2008
Posts: 19
Ribbonic Plague See this member's comment history on his/her Profile page.
Whoah rep to you for your super fast answer!

Thanks for the suggestion. Let me try this out...
  Reply With Quote
 
     

Your Answer
Email me when someone replies to my answer
Join Login





Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

 
Similar Sponsors


Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Similar Threads
Continued Pre-Trail Conference
(0 replies)
Blago continued
(12 replies)
ugh continued.dilemmas!
(4 replies)
He won't leave CONTINUED.
(1 replies)
Should I replace or repair my tv? (Continued)
(3 replies)

Search this Thread

Advanced Search

Bookmarks

Sponsors



Copyright ©2003 - 2009, Ask Me Help Desk.
All times are GMT -8. The time now is 04:43 PM.