Re: NativeEvent Get Type Issue
Hi Thomas,
Thanks for your response. The only reason I have the DeferredCommand
in there is to actually spit this out. If I don't defer it, my
application simply freezes as its spiting out this error as I move my
mouse around. So essentially I don't even see the println since this
preview occurs and crashes. My point is that the error still occurs
regardless.
Any other thoughts?
Thanks
On Jan 7, 4:35 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Jan 6, 10:21 pm, Salman Hemani <salman.hem...@gmail.com> 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);
> }
> });- Hide quoted text -
>
> - Show quoted text -
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home