当鼠标输入时,弹出式面板的工作方式将显示并在离开时将隐藏,当光标在弹出窗口内移动时,弹出式面板显示将保持结束。
答案 0 :(得分:0)
我这样做但是它有问题弹出窗口没有停留....任何想法?
Event.addNativePreviewHandler(new NativePreviewHandler() {
public void onPreviewNativeEvent(final NativePreviewEvent event) {
final int eventType = event.getTypeInt();
switch (eventType) {
case Event.ONMOUSEOUT:
{
System.out.println("hello");
popup.setVisible(false);
break;
}
case Event.ONMOUSEOVER:
{
l1.addMouseOverHandler(new MouseOverHandler()
{
public void onMouseOver(MouseOverEvent event)
{
popup.show();
popup.setPopupPositionAndShow(new PopupPanel.PositionCallback()
{
public void setPosition(int offsetWidth, int offsetHeight)
{
int left = (Window.getClientWidth() - offsetWidth) / 24;
int top = (Window.getClientHeight() - offsetHeight) / 5;
popup.setPopupPosition(left, top);
}
});
MouseOutHandler handler1=new MouseOutHandler()
{
public void onMouseOut(MouseOutEvent event)
{
System.out.println("welcome2");
popup.setVisible(false);
}
};
popup.addHandler(handler1,MouseOutEvent.getType());
popup.sinkEvents(Event.ONMOUSEOUT);
event.preventDefault();
}
});
break;
}
default:
}
}
});