【问题标题】:Mouse events are not working in gwt popup panel鼠标事件在 gwt 弹出面板中不起作用
【发布时间】:2014-01-02 18:34:09
【问题描述】:

MouseUp 和 Mousedown 事件不适用于 GWT 中的 PopupPanel,但相同的代码适用于 GWT 中的普通视图。在编写鼠标事件之前我们需要做些什么GWTPopupPanel.请尽快指导我。

【问题讨论】:

  • 请分享您目前编写的代码,以帮助我们查明问题。
  • 这方面的大多数问题都源于使用setModal(true) - 强烈建议不要这样做。如果这样做,请尝试改用setGlassEnabled(true)。
  • 您好,我编写了如下代码。 Imagepane.addMouseDownHandler(new MouseDownHandler (){ @override public void onMouseDown(MouseDownEvent event) { x=event.getX()-Imagepane.getAbsoluteLeft(); Y=event.getY()-Imagepane.getAbsoluteTop(); }}) ;
  • 对于视图屏幕上的上述代码,如果我们单击按钮,则会出现一个弹出窗口,如果我们单击一个按钮,我们将在那里获得一些图像,我需要这个鼠标事件应该可以工作。但是缩放和旋转图像正在工作..但是这个鼠标事件不起作用..
  • @ChrisLercher...我检查了我的代码,但在任何地方都找不到“setModal(true)”。请做必要的事情。我怀疑某些 gwt 旧版本的鼠标事件不起作用gwt中的弹出面板..请清楚地解释我需要在哪里进行更改..希望专家帮助我解决问题..:)

标签: gwt mouseevent popuppanel


【解决方案1】:
                      popup.addMouseUpHandler(new MouseUpHandler()
            {
                public void onMouseUp(MouseUpEvent event)
                {

            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);


                  }
            });
            }
            });

【讨论】:

  • 您需要添加有关您的答案的更多信息。
【解决方案2】:

我已经通过在包含 DateBox 小部件的弹出面板上调用“setModal(false)”为自己解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 2014-12-14
    • 2011-02-02
    • 2015-06-23
    • 2014-03-24
    相关资源
    最近更新 更多