Hi,
Is there any way to get mouse x-y coordinates when a form item clicked?
Thanks in advance.
Hi,
Is there any way to get mouse x-y coordinates when a form item clicked?
Thanks in advance.
try adding a mousemovehandler (or mouseclickhandler) into the form container. Then retrieve position through getX() and getY()
.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.
}
});