Closing a Form with the ESC Key
If you would like to allow the user to close a form using the ESC key, place the following script in the form's OnKey event:
|
if a_user.key.value = "{ESC}" if parentform.mode_get()= "View" a_user.key.handled = .T. if a_user.key.event = "down" parentform.close() end if end if end if |
By adding parentform.mode_get()= "VIEW", you make sure that the user maintains normal Cancel functions when pressing ESC in ENTER, CHANGE, FIND, or QUERY modes.
See Also
Supported By
Alpha Five Version 5 and Above