What, you want to read properties from the Event? Absurd!

// (disclaimer: hand written in Gmail)
HanderRegistration reg = Event.addNativePreviewHandler(new
NativePreviewHandler()
{
  public void onPreviewNativeEvent(NativePreviewEvent event)
  {
    Event event0 = Event.as(event.getNativeEvent());
    if (event0.getTypeInt() == Event.ONKEYDOWN)
    {
      int keyCode = event0.getKeyCode();
      if (condition) // optional
      {
        event.cancel();
      }
    }
  }
});

-- 
Mat Gessel
http://www.asquare.net

On Mon, Aug 31, 2009 at 6:29 AM, monkeyboy<dilbert.elbo...@gmail.com> wrote:
>
> In my code I am using onKeyDownPreview to hide a popup when the escape
> key is hit.
>    public boolean onKeyDownPreview(char key, int modifiers) {
>        switch (key) {
>            case KeyCodes.KEY_ESCAPE:
>                hide();
>                break;
>        return true;
>    }
> But the onKeyDownPreview is deprecated and I was wandering how would a
> version with onPreviewNativeEvent (the new way of handling events)
> would look like? Any suggestions? Am I the only one to think that the
> Google documentation about this is too terse?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to