如何在SmartGWT日历中处理特定事件的鼠标右键单击? [英] How to handle right mouse click on the specific Event in SmartGWT Calendar?
问题描述
我想为SmartGWT日历中的每个事件右键单击创建一个上下文菜单,或者简单地处理右键单击事件以显示一个弹出窗口。
I want to create a context-menu under a right click for every Event in SmartGWT Calendar or simply handle right-click on event to display a pop-up window.
calendar.addEventClickHandler(new EventClickHandler() {
@Override
public void onEventClick(TimetableEventClick event) {
// TODO Auto-generated method stub
}
});
上面的代码不允许我根据鼠标左/
我可以添加到日历实例中的处理程序:
Code above don't let me to differ actions depending on left/right mouse was clicked. There is a handler I can add to calendar instance:
calendar.addRightMouseDownHandler(new RightMouseDownHandler() {
@Override
public void onRightMouseDown(RightMouseDownEvent event) {
// TODO Auto-generated method stub
}
});
...但是如何获得正确点击的事件的信息?没有event.getId()可用,没有任何类似。我想假设getX(),getY()和玩位置不是一个解决方案?
...but how can I get info which event was clicked exactly? No event.getId() available, neither anything similar. I suppose getX(), getY() and playing with position is not a solution?
BTW:在GWT处理右键单击仍然是一个坏习惯?
BTW: Is handling right-clicks in GWT still a bad habit? Should I leave its functionality for a browser?
推荐答案
我想这是你想要的:
calendar.addShowContextMenuHandler(new ShowContextMenuHandler() {
@Override
public void onShowContextMenu(ShowContextMenuEvent event) {
event.cancel();
// your code
}
});
我不认为在GWT中右键点击是一个坏习惯。如果是这样,这些方法将没有在API中被定义以被重写。
I don't think hadling right-click in GWT is a bad habit. If it is so, these methods would have not been defined in the API to be overridden.
这篇关于如何在SmartGWT日历中处理特定事件的鼠标右键单击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!