On 20 juin, 18:23, Manuel <[email protected]> wrote: > What's the best way to implement Gmail-like keyboard shortcuts? > > I'd like to get all keypresses, except those in text boxes. > > I've searched the archives, and I can't find a good way to do this.
Two solutions immediately come to mind: 1. create a widget and add a keypress handler (addDomHandler, this is a protected method so you have to inherit an existing Widget subclass: SimplePanel, AbsolutePanel, etc.); you should get events thanks to bubbling, but not events directed to text boxes because they "eat" them (stopPropagation) 2. preview events (Event.addNativePreviewHandler); here you'd get events before they get to their target, including text boxes, so you'd have to check that the actual target is not a text box. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
