Escape key to dismiss dialogs

Dave Cragg dave.cragg at lacscentre.co.uk
Tue Feb 27 03:06:41 EST 2007


On 27 Feb 2007, at 05:56, Bill Vlahos wrote:

>  It is common for dialog boxes to cancel when the user presses the  
> Esc key. Unfortunately when I press the Esc key on an ask dialog it  
> simply enters something in the field.
>
> Is this a bug? How do I get the desired behavior?

One way I've handled this is to put the following handler in the  
stack script of the main stack.

on escapeKey
   if there is a button "Cancel" then
     click at the loc of button "Cancel"
   else if there is a button "Close" then
    click at the loc of button "Close"
  end if
end escapeKey

Cheers
Dave



More information about the use-livecode mailing list