[Project_owners] capturing "enter" key for <window/> and <dialog/>?

Neil neil at parkwaycc.co.uk
Wed May 25 14:38:40 EDT 2005


Eric Jung wrote:

>I'd like to capture when the user presses enter/return and automatically click a "close" <button/> on the <window/> (also have a close <button/> on a <dialog/> for which I'd like the same action).
>
>I suspect this can be done with an event listener on the <window/> or <dialog/>, but I haven't figured it out precisely. Has anyone does this before?
>  
>
Actually it can't be done. What <dialog> does is to add two event 
listeners, one for the close button and one for the esc key. Both then 
call the ondialogcancel action. For a window, you should use a <key> 
element in preference to adding a key event listener.


More information about the Project_owners mailing list