0

Tree with context menu - click problem

asked 2010-10-31 08:27:09 +0800

manny gravatar image manny
3

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

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2011-02-27 10:33:05 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

updated 2011-02-27 10:44:20 +0800

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. :-(

link publish delete flag offensive edit

answered 2011-05-17 10:21:18 +0800

valmar gravatar image valmar
925 2 13
http://www.timo-ernst.net

I found a solution. I simply turned off selection on right click for Listitems

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-10-31 08:27:09 +0800

Seen: 887 times

Last updated: May 17 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More