On Jan 6, 10:21 pm, Salman Hemani <[email protected]> wrote:
> This is a good one. Totally confused. I am porting over an application
> from GWT 1.5 - 1.7 (I still have to upgrade to 2.0 but that will come
> at a later stage. The onEventPreview used to block the escape key.
> When I ported over to the NativePreviewHandler things ofcourse
> changed. Before I even get to checking the escape key I was fiddling
> around with the nativeEvent itself and I am running into something
> wierd. Here is the code:
>
> public void onPreviewNativeEvent(final NativePreviewEvent
> nativePreviewEvent) {
>
> final NativeEvent nativeEvent =
> nativePreviewEvent.getNativeEvent();
>
> DeferredCommand.addCommand(new Command() {
>
> public void execute() {
>
> System.out.println(nativeEvent.getType());
>
> }
> });
>
> It spits out an error at nativeEvent.getType() which is as follows:
>
> [ERROR] Uncaught exception escaped
> com.google.gwt.core.client.JavaScriptException: (Error): Member not
> found.
>
> number: -2147352573
> description: Member not found.
>
> at com.google.gwt.dom.client.DOMImpl.eventGetType(Native Method)
> at com.google.gwt.dom.client.NativeEvent$.getType$(NativeEvent.java:
> 209)
> at com.christiedigital.widgets.core.popup.BasePopupPanel$1.execute
> (BasePopupPanel.java:83)
> at com.google.gwt.user.client.CommandExecutor.doExecuteCommands
> (CommandExecutor.java:310)
> at com.google.gwt.user.client.CommandExecutor$2.run
> (CommandExecutor.java:205)
> at com.google.gwt.user.client.Timer.fireImpl(Timer.java:160)
> at com.google.gwt.user.client.Timer.fireAndCatch(Timer.java:146)
> at com.google.gwt.user.client.Timer.fire(Timer.java:138)
>
> Any insights?
The events cannot be used "async"; you must retrieve all the
properties upfront before doing your DeferredCommand:
public void onPreviewNativeEvent(NativePreviewEvent
nativePreviewEvent) {
NativeEvent nativeEvent =
nativePreviewEvent.getNativeEvent();
final String eventType = nativeEvent.getType();
DeferredCommand.addCommand(new Command() {
public void execute() {
System.out.println(eventType);
}
});
--
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.