How the popup panel work when on the mouse enter it will show and on leaving it will hidden and on showing of popup panel when the cursor move inside the popup it will stay over.

有帮助吗?

解决方案

I am doing this but it is having problem that the popup is not staying....any idea?

  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: 

        }
      }
    });
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top