Is there a possibility to apply a ContextMenu for a canvas but excluding its childrens?
If so, how can I do that?
If so, how can I do that?
m_mainViewPort.addRightMouseDownHandler(new RightMouseDownHandler() {
public void onRightMouseDown(RightMouseDownEvent event) {
if (event.getSource() == m_mainViewPort) {
popup.showContextMenu();
} else {
event.cancel();
}
}
});
menuBar.addRightMouseDownHandler(new RightMouseDownHandler() {
public void onRightMouseDown(RightMouseDownEvent event) {
final String mid = this.getClass().getName()
+ ".onRightMouseDown(): ";
Log.debug(mid + "Right click on the main menu");
event.cancel();
Log.debug(mid + "The event has been cancelled");
}
});
m_mainViewPort.addRightMouseDownHandler(new RightMouseDownHandler() {
public void onRightMouseDown(RightMouseDownEvent event) {
final String mid = this.getClass().getName()
+ ".onRightMouseDown(): ";
Log.debug(mid + "is called");
Canvas eventTarget = EventHandler.getTarget();
if (eventTarget == m_mainViewPort) {
Log.debug(mid + "The user did a right-click on the main panel");
popup.showContextMenu();
Log.debug(mid + "The popup has been shown");
} else {
Log.debug(mid + "The user right-clicked on the child widget");
event.cancel();
Log.debug(mid + "The event has been canceled");
}
}
});
Comment