Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Getting mouse position

    Hi,

    Is there any way to get mouse x-y coordinates when a form item clicked?

    Thanks in advance.

    #2
    try adding a mousemovehandler (or mouseclickhandler) into the form container. Then retrieve position through getX() and getY()

    Comment


      #3
      Code:
      .addFormItemClickHandler(new FormItemClickHandler()
      {
            @Override
            public void onFormItemClick(FormItemIconClickEvent event)
            {
              int xPosition = event.getItem().getIconPageRect(event.getIcon()).getLeft(); //to get right position add .getWidth() and be sure you've called setWidth on the FormItemIcon when you created it.
              int yPosition = event.getItem().getIconPageRect(event.getIcon()).getTop(); //to get bottom position add .getHeight() - same goes for setHeight on the FormItemIcon.
            }
      });

      Comment

      Working...
      X