Native Event either skips my code or doesn't call my event handler

34 views
Skip to first unread message

Bernmeister

unread,
Sep 15, 2010, 3:38:00 AM9/15/10
to Google Web Toolkit
Using GWT 2.1.0 M3 with the following code snippet:

@UiField ListBox myListBox;

. . .

Window.alert( "here" );
ChangeEvent.fireNativeEvent( Document.get().createChangeEvent(),
myListBox );
Window.alert( "there" );

I get "here" but not "there". Further, the event handler is also
subsequently called...

@UiHandler( "myListBox" )
void handleSelection( ChangeEvent changeEvent )
{
Window.alert( "everywhere" );
}

and I get "everywhere". This is strange as it seems as if the event
is fired and calls other code, but does not return to continue
execution (as "there" is not pumped out).

If I alter the event call to be

ChangeEvent.fireNativeEvent( Document.get().createChangeEvent(),
this );

where 'this' is an object which extends Composite, I get "here" AND
"there" but not "everywhere". That is the event handling code is not
triggered.

So what is the correct way to trigger an event such as a list box's
value being changed?


Thanks in advance,

Bernmeister.
Reply all
Reply to author
Forward
0 new messages