I'm trying to implement both right click and drag and drop. I want a
draggable label to also be rightclickable. However, when I add an
"onBrowserEvent" method to my label (to add right click functionality)
it removes the ability to drag objects (even if this function is
empty). It seems like this is because a left click seems to call
onBrowserEvent repeatedly. The drag functionality works when I remove
this function completely, but of course it removes the right click
functionality. Is there any way to disable calling onBrowserEvent on a
left click?
small bit of my code:
public class AdvLabel2 extends Label implements AdvClickNotifier {
private AdvClickListener listener = null;
public void onBrowserEvent(Event event) {
GWT.log("onBrowserEvent", null);
event.cancelBubble(true);//This will stop the event from being
propagated to parent elements.
event.preventDefault();
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEUP:
if (DOM.eventGetButton(event) == Event.BUTTON_LEFT) {
GWT.log("Event.BUTTON_LEFT", null);
listener.onClick(this, event);
}
if (DOM.eventGetButton(event) == Event.BUTTON_RIGHT) {
GWT.log("Event.BUTTON_RIGHT", null);
listener.onRightClick2(this, event);
}
break;
case Event.ONDBLCLICK:
break;
case Event.ONCONTEXTMENU:
GWT.log("Event.ONCONTEXTMENU", null);
break;
default:
// Do nothing
}//end switch
}
}
http://whatwouldnickdo.com/wordpress/370/gwt-right-click-context-menu/
I used that for enabling right clicks.
http://code.google.com/p/gwt-dnd/
I used that for enabling drag and drop.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---