GWT onmouseover et onmouseout
Bonjour,
Je veux que mon VerticalPanel vPanel dispose d'un listener onmouseover et onmouseout pour détecter lorsque la souris viens sur lui ou à l'extérieur de lui. Mon vpanel contient 2 autres widgets.
Le problème vient du fait que lorsque je passe d'un widget à un autre, le listener onmouseout se déclenche lorsque la souris arrive à la frontière de ces deux widgets alors que pourtant je suis bien dans mon vPanel englobant.
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Button update = new Button(HTMLUpdatePanel.MODIFIER);
update.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
RootPanel.get(divName).clear();
RootPanel.get(divName).add(panel);
}
});
HorizontalPanel panelAction = new HorizontalPanel();
panelAction.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
panelAction.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
panelAction.setSize("600px","50px");
panelAction.add(update);
VPanel vPanel = new VPanel();
vPanel.setBorderWidth(1);
vPanel.add(panelAction);
vPanel.add(new HTML("onmouseoverhjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>hjgh<br/>"));
RootPanel.get(divName).clear();
RootPanel.get(divName).add(vPanel); |
Et ma classe vPanel :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
package com.tagdevin.editor.client.html;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.VerticalPanel;
class VPanel extends VerticalPanel {
public VPanel()
{
super();
sinkEvents(Event.ONMOUSEOVER);
sinkEvents(Event.ONMOUSEOUT);
}
@Override
public void onBrowserEvent(Event event)
{
switch(DOM.eventGetType(event)) {
case Event.ONMOUSEOVER:
System.out.println("Mouseover");
break;
case Event.ONMOUSEOUT:
System.out.println("Mouseout");
break;
default:
break;
}
}
} |
A l'execution cela me donne :
Mouseover
Mouseout
Mouseover
Mouseout
au lieu de :
Mouseover
Mouseover
Mouseover
Mouseout
Merci de votre aide.