Ask Experts Questions for FREE Help !
Ask
    Ribbonic Plague's Avatar
    Ribbonic Plague Posts: 19, Reputation: 2
    New Member
     
    #1

    Sep 17, 2009, 11:13 AM
    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 every time 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!
    Perito's Avatar
    Perito Posts: 3,139, Reputation: 150
    Ultra Member
     
    #2

    Sep 17, 2009, 11:20 AM

    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.
    Ribbonic Plague's Avatar
    Ribbonic Plague Posts: 19, Reputation: 2
    New Member
     
    #3

    Sep 17, 2009, 11:23 AM

    Whoah rep to you for your super fast answer!

    Thanks for the suggestion. Let me try this out...

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Blago continued [ 12 Answers ]

President-elect Obama conducted an intensive internal audit of the "Office of the President-elect " and cleared himself and his staff of any wrong-doing in the Pay-for-play-the-Chicagoway scandal .But since this is an ongoing investigation his team voted 1-0 to not release the results of the...

He won't leave CONTINUED. [ 1 Answers ]

Some of you might remember me. Here is my previous post: I have been married to a man for almost 4 years. We have on child together and I have two from a previous relationship. I do not love him anymore. Through no fault of my own I am just tired of the BS. He has cheated on me, has a drug...


View more questions Search