I'm trying to prevent my textbox from firing the onChange
event. In the following code I'm previewing all the native events to
search for onChange event. However, it seems preview process never
got any onChange event.
On the other hand, I was able to get the onChange event from the
browser.
Is there anything I can do to preview my text box onChange
events?
Thanks!
public class WidgetTester implements EntryPoint {
public void onModuleLoad() {
MyTextBox t = new MyTextBox();
Event.addNativePreviewHandler(new EventPreviewManager());
RootPanel.get().add(t);
}
public class MyTextBox extends TextBox
{
public void onBrowserEvent( Event event )
{
switch (DOM.eventGetType(event))
{
case Event.ONCHANGE:
System.out.print("Text box changed");
}
super.onBrowserEvent(event);
}
public MyTextBox()
{
super();
this.sinkEvents(Event.ONCHANGE);
}
}
protected class EventPreviewManager implements NativePreviewHandler
{
public void onPreviewNativeEvent(NativePreviewEvent event)
{
int type = event.getTypeInt();
if (type == Event.ONCHANGE)
{
System.out.print("Preview Change Event");
}
}
}
--
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