Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating an auto-repeat command button
Message
From
10/01/2002 15:46:35
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Creating an auto-repeat command button
Miscellaneous
Thread ID:
00603161
Message ID:
00603161
Views:
76
Is there a way to detect the situation where a user is holding down the space key when they're on a command button? What I'm trying to do is create the equivalent of an auto-repeat command button whose Click method gets repeatedly called if the button has been held down for specific interval of time.

Specifically, I would like to detect these situations so I can:

a) Provide a visual alert to the user that they are holding down a button

b) Perform the click event, pause, and if the user is still holding down the button perform another click event and then go into a loop, performing click events (with optional short pauses between click events) until the user releases their space key.

I can do this for 'mouse click and holds' by trapping the mouse down event. I don't see an equivalent way to trap a 'space keydown' event in a command button.

I've investigated the inkey() and chrsaw() functions without much success. I'm thinking that one technique may be to activate a timer in the button's GotFocus event and use a Windows API call (which one???) to check if the space key is being held down and if so, generate the click events this way??? Thinking outloud, I would disable the timer on a True mouse click event, KeyPress event (meaning the space key is no longer being held down), and the LostFocus event.

Do I need to construct a 'custom' button in order to do this or does the standard button class provide me with the tools necessary to accomplish what I want to accomplish?

Any feedback on the concept of an auto-repeat button and/or its implementation would be appreciated.

Thanks!
Malcolm
Malcolm Greene
Brooks-Durham
mgreene@bdurham.com
Next
Reply
Map
View

Click here to load this message in the networking platform