Link to home
Create AccountLog in
Avatar of rkulp
rkulpFlag for United States of America

asked on

How Can I Disable Keyboard Entry?

I have a cancel button on a form that I want the user to be able to fire only with a mouse click. If it has focus, pressing the space bar will fire it. I don't know about other keys. This is usually not a problem but when an exceptionally large file is processed, the display may turn off and if the user presses the space bar to turn it on the cancel is fired. I could set the focus on another command button but the same kind of thing could interrupt the program. So, how can I prevent this from happening? I have considered putting in a text box that is not visible and sending focus there but am hesitant to do that.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer