Hello Hugh and Alex,
>> I suggest that you approach this a little differently:
>> when the context menu event fires on the image, store the
>> current image in a global variable. Then, when you get the
>> event when something is selected in the menu, pick up the
>> value of the global variable.
>>
>> Hugh
>>
> Thx Hugh, that's also my workaround for this issue - not quite
> elegant(beacause of global variable) but anyway. I just thought if there
> is any other/better way of doing this.
I also didn't want to use a global variable and fixed this problem by
dynamically adding a new property to the context menu that references
the selected data:
var menu = new qx.ui.menu.Menu();
var cmd = new qx.client.Command();
var item = new qx.ui.menu.Button("Add (after)", null, cmd);
menu.add(item);
menu.myProp = null; // a new property for storing the data
menu.addToDocument();
cmd.addEventListener("execute", function(e) {
var myProp = e.getData().getParentMenu().myProp;
});
tree.setContextMenu(menu);
tree.addEventListener("contextmenu", function(e) {
var selected = this.getSelectedElement();
if (selected instanceof qx.ui.tree.TreeFile) {
var menu = this.getContextMenu();
menu.setLeft(e.getClientX());
menu.setTop(e.getClientY());
menu.myProp = selected.myProp;
menu.show();
}
});
This way the menu knows the data of the TreeFile that was clicked.
Greetings, Rusi
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel