I have this playground code http://tinyurl.com/lojdq96.

I am trying to add a context menu to a button. Unfortunately it is a mess.

First I try, maybe, I can capture the right click

button.addListener('click', function(e){
   var click = e.getButton();
   console.log(click);
});

This almost never (99% of the time) works in Chrome. In Firefox it works 
always.

Alternative. I try to catch the 'contextmenu' event.

button.addListener('contextmenu', function(){
   button.setContextMenu(cmenu(button));
});

function cmenu(button){
   var menu = new qx.ui.menu.Menu(button);
   menu.placeToWidget(button, true);
   var button1 = new qx.ui.menu.Button('Test1');
   menu.add(button1);
   return menu;
}

This works but:
1. Sometimes it needs two right clicks to display the menu
2. The menu first pops at the mouse pointer and then jumps under the 
button. This is more visible in Firefox.

How can I display a context menu properly?

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to