GWT: Select a TreeItem with right click
Posted
by Ivan
on Stack Overflow
See other posts from Stack Overflow
or by Ivan
Published on 2010-04-25T16:57:53Z
Indexed on
2010/04/25
17:03 UTC
Read the original article
Hit count: 275
I'm capturing a right click event to show a context menu. What I haven't been able to figure out, is how to make the right click actually select the TreeItem, prior to showing of context menu.
All help is appreciated.
private Tree tree = new Tree() {
@Override
public void onBrowserEvent(Event event) {
if (event.getTypeInt() == Event.ONCONTEXTMENU) {
DOM.eventPreventDefault(event);
showContextMenu(event);
}
super.onBrowserEvent(event);
}
@Override
protected void setElement(Element elem) {
super.setElement(elem);
sinkEvents(Event.ONCONTEXTMENU);
}
};
© Stack Overflow or respective owner