|
Re: Form level capturing the ESC key
Posted: 30 Jun 09 2:20 AM
|
This is an easy one....
The problem is that you probably already have a button defined with the Cancel property set to True.
When you create a New Form, if it has a Cancel button, its Cancel property is set to true, which means that when the user hits Cancel, that button's handler gets executed.
How to run your Own code when the user hits Escape: - Create a New button (doesn't have to be OK or Cancel, it could be set to Custom). - Set its Cancel property to True. - Add your code to this button's handler. When you open up the form, if you hit ESC, the code you added will be executed and the form will NOT be dismissed.
If you rather have the ESC key do nothing, make sure that none of your buttons have the Cancel Property set to true. This way, when the user clicks the ESC key no code will execute.
|
|
|