Thanks for using Pivot!
You have the right interface for adding the context menus. But, each
time it is called there will be a different Menu object. You can
persist your planned menu objects any way you want. In our application
we defined them in a bxml file and just saved pointers to each
Menu.Section inside one Java class. Then (depending on the context) we
add the appropriate sections to the passed in Menu object.
The logic you have won't work because there is always a new Menu object
each time the method is called. But, you can persist your Menu.Item (or
Menu.Section) objects so they just have to be added each time (but not
recreated).
HTH,
~Roger Whitcomb
On 8/4/12 10:43 AM, jr801 wrote:
Hi,
After looking at this thread:
http://apache-pivot-users.399431.n3.nabble.com/context-menu-on-treeNode-tt4021940.html#a4021945
I implemented the following code:
MyTreeView.setMenuHandler(new MenuHandler.Adapter() {
public boolean configureContextMenu( Component component, Menu menu, int x,
int y ) {
if (!my_menu_added) {
// add menu-section/menu-items ...
my_menu_added=true;
}
return false;
}
}
So the question is, can I make a context-menu persistent on a
TreeBranch-object? Because the second time I right-click on the tree-node,
my_menu_added will be false and so the menu won't pop-up.
thanks
--
View this message in context:
http://apache-pivot-users.399431.n3.nabble.com/how-to-add-persistent-context-menu-on-treebranch-node-tp4022002.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.