PDA

View Full Version : [FIXED] Click events don't get fired



Bezge
2 Jun 2009, 5:01 AM
I registered some click event on a GWT Label but with the latest gxt version the event doesn't get fired anymore. Also I tried some workaround using com.extjs.gxt.ui.client.widget.Html but the the event doesn't get fired in the hosted mode browser.

sample Code:

package gxt.playground.client;

import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.FieldEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

public class Playground implements EntryPoint {

private Viewport viewport;

@Override
public void onModuleLoad() {

viewport = new Viewport();

Label l1 = new Label("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.");

l1.addClickHandler(new ClickHandler() {

public void onClick(ClickEvent event) {
Window.alert("click1");
}

});

Html l2 = new Html("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.");

l2.sinkEvents(Events.OnClick.getEventCode());
l2.addListener(Events.OnClick, new Listener<FieldEvent>() {

@Override
public void handleEvent(FieldEvent be) {
Window.alert("click2");
}
});

viewport.add(l1);
viewport.add(l2);

RootPanel.get().add(viewport);
}

}

sven
2 Jun 2009, 5:17 AM
The issue with GWT widgets is already fixed in SVN.

Your workaround has a issue in your code. Html is not firing FieldEvents. You get a classcastexception there.

Bezge
2 Jun 2009, 5:28 AM
thx for your fast reply. Ok workaround works now :)
But the click event on the GWT label doesn't get fired, although I used the latest code from your svn.

sven
2 Jun 2009, 6:11 AM
But now it is fixed in SVN :)