This suited me perfectly.

On May 27, 5:25 pm, John Ho <[email protected]> wrote:
> Have you taken a look at the static Event.addNativePreviewHandler method?
>
> Example:
>
> Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
> @Override
>  public void onPreviewNativeEvent(NativePreviewEvent event) {
> switch (event.getTypeInt()) {
>  case Event.ONKEYDOWN:
> int keyCode = event.getNativeEvent().getKeyCode();
>  // .....
>
> }
> }
> });
>
> On Fri, May 27, 2011 at 3:35 PM, pjspychala <[email protected]>wrote:
>
>
>
>
>
>
>
> > I want to catch certain keypress events that get caught no matter what
> > widget is focused.
>
> > I have:
>
> > public class MainController {
> >  public void onModuleLoad()
> >  {
> >    RootLayoutPanel.get().add(new MainView());
> >  }
> > }
>
> > public class MainView extends Composite implements
> > HasKeyPressHandlers, KeyPressHandler {
> >  public MainView() {
> >    this.addKeyPressHandler(this);
> >    addManyWidgets();
> >  }
> >  void onKeyPress(...) { ... }
> >  HandlerResitration addKeyPressHandler(...) {  ... }
> > }
>
> > But the events get only caught when the focus is in a widget in
> > mainview and are NOT caught when I just click anywhere (thats not a
> > focusable widget) in the mainview.
>
> > --
> > 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.

-- 
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.

Reply via email to