Announcement

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

    Getting the coordinates of FormItemIcon

    How do I get the coordinates of the FormItemIcon. We display a form item help icon next to the field and on click need to display customized canvas content as hover help on top and centered on the form item icon. What's the recommended way to do this?

    I need to get the coordinates of the form item icon and then position the canvas on top accordingly, but I don't see any API in the FormItemClickHandler for this.

    Code:
    final FormItemIcon helpIcon = getHelpIcon();
    helpIcon.addFormItemClickHandler(new FormItemClickHandler() {
       public void onFormItemClick(final FormItemIconClickEvent event) {
          // custom code to display the help canvas on top of the help icon
       }
    });

    #2
    See FormItem.getIconRect().

    Comment


      #3
      I tried these both, however they don't seem to be giving me the correct coordinates relative to the browser window. If I scroll the page up, the coordinates returned by getIconRect seem to be the same.

      event.getItem().getIconPageRect(event.getIcon())
      event.getItem().getIconRect(event.getIcon())

      Comment


        #4
        getIconPageRect() would be expected to change with scrolling, getIconRect() will not, including for scrolling of the form itself.

        Comment


          #5
          Thanks getIconPageRect() works perfectly. There was an issue with my code, I was trying to get the height of the popup canvas before it was drawn, so the height was not getting set correctly, it was silly user error :)

          Thanks again!
          Sujay

          Comment

          Working...
          X