Thanks, I added one listener to show the menu and
one to hide it. Seems to work.

Sorry for my english.

qx.Class.define("qxframemenu.Application",
{
        extend : qx.application.Standalone,
        members :
        {
                main : function()
                {
                        this.base(arguments);
                        if (qx.core.Environment.get("qx.debug"))
                        {
                                qx.log.appender.Native;
                                qx.log.appender.Console;
                        }
                        
                        var button1 = new qx.ui.form.Button("First Button",
"qxframemenu/test.png");

                        var doc = this.getRoot();
                        doc.add(button1, {left: 100, top: 50});
                        button1.addListener("execute", function(e) {

                                var win = new qx.ui.window.Window("my frame");
                                win.setWidth(400);
                                win.setHeight(300);
                                var layoutDock = new qx.ui.layout.Dock();
                                win.setLayout( layoutDock );
                                this.getRoot().add(win, {left:20, top:20});

                                var iframe = new qx.ui.embed.Iframe("").set({
                                        frameName: "myframe",
                                        nativeContextMenu : false
                                });
                  
                                var menu = new qx.ui.menu.Menu();
                                var b1 = new qx.ui.menu.Button( "b1", null );
                                var b2 = new qx.ui.menu.Button( "b2", null );
                                menu.add( b1 );
                                menu.add( b2 );
                                
                                b1.addListener("execute", function(e){
                                        this.warn("b1 execute");
                                });
                                b2.addListener("execute", function(e){
                                        this.warn("b2 execute");
                                });
                                
                                win.add(iframe);
                                win.center();
                                win.open();
                  
                                iframe.addListener( "load", function(e) 
                                {
                                        var body =
iframe.getContentElement().getDomElement().contentDocument.body;
                                        qx.event.Registration.addListener( 
body, "contextmenu", function(e) 
                                        {
                                                var location = 
iframe.getContentLocation();
                                                var left = location.left + 
e.getDocumentLeft(); 
                                                var top = location.top + 
e.getDocumentTop();            
                                                var point = { left: left, top: 
top};
                                                menu.placeToPoint(point);
                                                menu.show();
                                        }, this);       
                                        qx.event.Registration.addListener( 
body, "click", function(e) 
                                        {
                                                menu.hide();
                                        }, this);       
                                }, this);
                  

                        }, this);
                }
        }
});



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Context-menu-in-iframe-tp7586697p7586699.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to