Thank you Fabian. Your hint with  
e.getData().getParentMenu().getOpener() was the solution. Since setting 
of the "opener" property wasn't the best idea because of this line in
qx.ui.menu.Menu._beforeDisappear function:

  if (vOpener) {
    vOpener.removeState(qx.ui.form.Button.STATE_PRESSED);
  }

i made it with setUserData.

Best Regards,
alex.d
> Hi Alex,
>
>>>  I created a small demo html that can be run from the demo folder 
>>> that demonstrates the problem. I would really appreciate any help in 
>>> this case(workarounds are welcome!).
>>>
>>> Best Regards,
>>> alex.d
>>>
>> Does the fact that even main qooxdoo developers do not answer to this 
>> post, means that my problem is unsolvable?(Andreas, Sebastian?) I 
>> would like to know if this is a
>> -qooxdoo-bug
>> -qooxdoo-structure problem
>> -just smth. that i don't understand.
>> One more time the problem-demonstrating-problem code(it's not as big 
>> as it looks ;-)
>
> After Sebastians patch you should now be able to get a reference to 
> the menu button. Unfortunately there is no connection between the 
> context menus and the Object containing the menu. The contextMenu 
> property of the Widget object really needs some improvements.
>
> What you can do is set the opener property of the context menu in the 
> "oncontextmenu" callback to you image object before you open the menu. 
> In the "execute" callback you can reach the opener by calling
>
> e.getData().             // returns the menu.Button
>   getParantMenu(). // returns the menu.Menu
>   getOpener();         // returns the opener (your image)
>
> Here the relevant code snipplets:
>
>        var com = new qx.client.Command;
>        com.addEventListener("execute", function(e){
>            this.debug("What object i've clicked on?");
>            this.debug("e.getData() = " + 
> e.getData().getParentMenu().getOpener());  // <--- !!!
>        }, this);
>
>        //Context menu
>        var cmenu = new qx.ui.menu.Menu;
>        var m_1 = new qx.ui.menu.Button("Show Target", null, com);
>        cmenu.add(m_1);
>        cmenu.addToDocument();
>              //Show context menu
>        image.setContextMenu(cmenu);
>        image.addEventListener("contextmenu", function(e) {
>            this.getContextMenu().setLeft(e.getClientX());
>            this.getContextMenu().setTop(e.getClientY());
>            this.getContextMenu().setOpener(this);     // <--- !!!
>            this.getContextMenu().show();
>        }, image);
>
>
>
> A better implementation for context menus is planned. This will assign 
> the correct opener automatically.
>
> I hope this helped.
>
> Best,
> Fabian
>

-------------------------------------------------------------------------
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

Reply via email to