-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have got a navigating tree loading different components (left or right click) and a context menu on this tree for special operations (right click).
The issue is, on right click the tree loads a component AND the context menu pops up. But I want to have the following behavior: On right click the context menu (and only the context menu) should raise up.
I use the following code:
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
..........
menuTree.addEventListener(Events.ON_SELECT, new MenuSelectListener());
..........
class MenuSelectListener implements EventListener{
public void onEvent(Event event) throws Exception {
// T try to intercept the right click event but it doesn't work (there is only a SelectEvent).
if (Events.ON_RIGHT_CLICK.equals(event.getName())) {
return;
}
Treeitem item = menuTree.getSelectedItem();
........
and the zul file:
<west size="200px" splittable="true" flex="true" collapsible="true" title="Menu">
<div>
<tree id="menuTree" zclass="z-dottree" style="border: 0px none white;" context="mainPopup">
</tree>
<menupopup id="mainPopup">
<menuitem id="mainPopupHeader" label="Context Menu" />
<menuseparator />
<menuitem id="createCfr" image="/images/icons/group_add_16x16.png" label="Create " />
<menuitem image="/images/icons/cancel_16x16.png" label="Cancel" />
</menupopup>
</div>
</west>
Thx for any help,
manny
Same question.
Any solution for that?
I tried to additionally catch the onRightClick Event on the treerow and then set a global variable rightClicked=true.
Then, in the onSelect event of the tree, I check if rightClicked=true.
That won't work through, because the onSelect event gets called BEFORE the onRightClick event. :-(
I found a solution. I simply turned off selection on right click for Listitems
Asked: 2010-10-31 08:27:09 +0800
Seen: 887 times
Last updated: May 17 '11