Best way to manage an "Esc" pressed by the user
Hi friends
I normally create dialogs to offer options to the user before executing the script functions. So, having a "Cancel" button in this dialog would suit the need for an user to cancel the operation.
But let´s say the user selected the options in the dialog and pressed button OK to start the execution of the process. The dialog will close and process will start. Suppose it will take 1 minute to complete.
If, inside this 1 minute, the user presses "Esc" key in keyboard, then the execution will stop, but it will display an alert (like an an error) it was not possible to finish the process (sure, he cancelled the operation).
What I want to understand: Is it possible to manage this "cancellation" of the user via the ESC and do not display alerts? For example, write a function that tells...If user presses "ESC", then abort the process and display no dialog.
Would an event listener that reads the keydown "ESC" would be suitable for this task? or is there any simpler or suitable way to do it?
Thank you very much for the tips.
Gustavo.
