Hi,
I am using gwt graphics and gwt dnd for a program. I have a button which when clicked creates a circle at specified position on the panel and the circle is draggable. For dragging i have used gwt-dnd. I have also added a click handler to the circle which when click should print "ERD Circle".
Here is the code layout:
Button b = new Button("Circle");
b.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
Circle c = new Circle(20, 15, 10);
d.add(c);
c.addClickHandler(new ClickHandler(){
@Override
public void onClick(ClickEvent event) {
// TODO Auto-generated method stub
System.out.println("ERD Circle");
}
});
dragController.makeDraggable(d);
boundaryPanel.add(d, 200, 200 );
}
});
This button is then added to an absolutepanel which in turn is added to the rootpanel.
Problem that i am facing is click handler does not work when it is made draggable. If i remove
dragController.makeDraggable(d);
click handler works perfectly fine.
Question:
- Am i doing anything wrong here?
- If the code is correct, then is there anything else that i need to add to get both click handler and draggable working?
Any suggestions will be of great help.
Thank you.