Document Information

Last modified:
2008/04/14 11:46 by ecker

How to implement a context-menu

To implement a context-menu you can use a code as showed in the following example:

// set up a command
var com = new qx.client.Command;
com.addEventListener("execute", function(e){
    this.debug("What object i've clicked on?");
    // show the opening widget
    this.debug("e.getData() = " + e.getData().getParentMenu().getOpener());
}, this);
 
// set up the context-menu
var cmenu = new qx.ui.menu.Menu;
// setup the button and add the command
var m_1 = new qx.ui.menu.Button("Show Target", null, com);
cmenu.add(m_1);
cmenu.addToDocument();
 
// show the context-menu
image.setContextMenu(cmenu);
image.addEventListener("contextmenu", function(e) {
            this.getContextMenu().setLeft(e.getClientX());
            this.getContextMenu().setTop(e.getClientY());
 
            // this step is important - set the image as the opening widget
            this.getContextMenu().setOpener(this);
 
            this.getContextMenu().show();
}, image);

The implementation of the context-menu will be rewritten to allow an easier use of this feature. In the new implementation the last section should not be needed. With a correct implementation of the context-menu only the call of

image.setContextMenu(cmenu);

should be needed to setup and use a context-menu.

Information

Last modified:
2008/04/14 11:46 by ecker

Account

Not logged in

 
 

Job Offers

To further improve qooxdoo we are seeking javascript developers. Read more...

Rich Ajax Platform (RAP)

RAP uses qooxdoo, Java and the Eclipse development model to build rich web applications. Read more...

qooxdoo Web Toolkit (QWT)

Similar to GWT this framework allows to create impressive qooxdoo applications just using Java. Read more...

Pustefix

Pustefix is a MVC-based web application framework using Java and XML/XSLT. Read more...

 
SourceForge.net Logo

Bad Behavior has blocked 0 potential spam attempts in the last 7 days.