Question

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.

Was it helpful?

Solution

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: 

        }
      }
    });
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top