PDA

View Full Version : mouse event detection problem in firefox since Gxt 2.0.2



sperry
21 Oct 2009, 1:55 AM
Hi,

I experienced a bug with mouse event detection since i moved from Gxt 2.0.1 to Gxt 2.0.2
The bug occurs in Firefox (i use 3.5) while it doesn't in hosted mode and Internet Explorer

I used the following code to reproduce the problem :


public class Test implements EntryPoint {

public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setLayout(new RowLayout());

LabelField lbl1 = new LabelField();
lbl1.setText("Move mouse over me");
lbl1.sinkEvents(Events.OnMouseDown.getEventCode());
lbl1.sinkEvents(Events.OnMouseOver.getEventCode());
lbl1.addListener(Events.OnMouseOver, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
Info.display("", "Lbl 1 Mouse over !!! ");
}
});
lbl1.addListener(Events.OnMouseDown, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
Info.display("", "Lbl 1 Mouse down !!! ");
}
});

LabelField lbl2 = new LabelField();
lbl2.setText("Move mouse over me");
lbl2.sinkEvents(Events.OnMouseDown.getEventCode());
lbl2.sinkEvents(Events.OnMouseOver.getEventCode());
lbl2.addListener(Events.OnMouseOver, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
Info.display("", "lbl2 Mouse over !!! ");
}
});

lbl2.addListener(Events.OnMouseDown, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
Info.display("", "Lbl 2 Mouse down !!! ");
}
});

ContentPanel cp1 = new ContentPanel();
cp1.setHeaderVisible(false);
ContentPanel cp2 = new ContentPanel();
cp2.setHeaderVisible(false);

cp1.add(lbl1);
cp2.add(lbl2);

viewport.add(cp1);
viewport.add(cp2);

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

}


When i move the mouse over the 2 LabelField, the event is well detected.
However if i click on one LabelField and then move the cursor to the other without releasing the mouse click, the MouseOver event is not detected on the second LabelField in Firefox whereas it is under IE

Thanks

sven
21 Oct 2009, 3:38 AM
This is nto a bug. This is how browser events, that you are using work. You need to get in touch with preview events and captaring events.

sperry
21 Oct 2009, 3:58 AM
Hi sven

i thought it was a regression because the firefox behaviour was the same than ie's with Gxt 2.0.1.

And sorry , i don't see what you mean with the "preview events" . Can you be more specific please ?

Thanks

sven
21 Oct 2009, 3:59 AM
Take a look at the baseeventpreview class. Draggable in GXT uses it for example.