Sunday, November 28, 2010

Re: clicking outside of widget seems to disable NativePreviewHandler ONKEYPRESS

I've figured out that what's causing the loss of keyboard events is my
call to SimplePanel.setWidget(), which happens as part of my app's
navigation, via an Activity implementation. I've boiled this down to a
simple example that's repeatable (for IE8, at least):

Java code <a href="http://pastebin.com/ykjvcNRh">here</a>.
UI Binder: <a href="http://pastebin.com/kEPck03X">here</a>.

My work-around hack is to skip the setWidget() call in my Activity's
start() method, if the containerWidget already contains it. This is a
bit ugly, since the actual SimplePanel is wrapped by a
ProtectedDisplay, which requires me to pass around a reference to my
original panel. But it works.

On Nov 27, 8:03 pm, KaffeineComa <kaffeinec...@gmail.com> wrote:
> I'm using a NativePreviewHandler to intercept ONKEYPRESS events
> application-wide. I'm doing this so that I can implement a customized
> text entry widget (example athttp://www.quickbrownfrog.com/#!typing:lesson:lesson001.xml:1).
>
> It's been working fine, but I recently noticed a problem on IE8: if
> the user clicks outside of my widget, the NativePreviewHandler no
> longer gets ONKEYPRESS events; it's as if the widget has "lost focus",
> even though it's not relying on focus for receiving events.
> Interestingly, it still seems to get mouse events, just not key
> presses. If the user clicks inside the widget, it will again start
> receiving ONKEYPRESS.
>
> This does not seem to happen on Safari, Firefox or Chrome.
>
> My understanding of Event.addNativePreviewHandler() is that it will
> receive ALL events, regardless of focus... is that incorrect?
>
> Thanks

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment