Hi Balage, Your problem is this line: button1.addListener("execute", this.__handleButton );
If the handler is called, "this" point to the button1 instance. To set "this" to an other scope, use the third parameter. In your case: button1.addListener("execute", this.__handleButton, this); Cheers, Chris balage42-qoox...@yahoo.com schrieb: > > Hello! > > I try to use a member function as a callback for my P2P Ajax function. > However, the function is always "undefined". Here is the relevant code > of my application: > > > --------------8<------------------------------------------- > > main : function() > { > [...] > // Create a button > var button1 = new qx.ui.form.Button("First Button", > "edemo/test.png"); > > // Document is the application root > var doc = this.getRoot(); > > // Add button to document at fixed coordinates > doc.add(button1, {left: 120, top: 50}); > > // Add an event listener > console.log( 'HandlerDef: '+this.__handleButton ); > button1.addListener("execute", this.__handleButton ); > }, > > __fillTable : function( pRequest ) { > alert( pRequest ); > }, > > __handleButton : function(e) { > var hrq = new edemo.AjaxTools(); > > console.log( 'Callback: '+this.__fillTable ); > hrq.sendXMLHTTPRequest( '<QD_FETCH_TEST/>', this.__fillTable, > null, false ); > } > > --------------8<------------------------------------------- > > Here the "HandlerDef" trace prints the right method and it is > successfully assigned to the event handler, OTOH, when calling it and > tracing the "callback" function, it returns undefined. > > I am sure I missed some vital aspect of the OO framework, but can't > see why doesn't sees the function? Or the this is "lost" (refers to > another object) for a function when called as an event handler? > > Thanks, > Balage > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Return on Information: > Google Enterprise Search pays you back > Get the facts. > http://p.sf.net/sfu/google-dev2dev > > ------------------------------------------------------------------------ > > _______________________________________________ > qooxdoo-devel mailing list > qooxdoo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel > -- Christian Schmidt Software Entwickler 1&1 Internet AG - Web Technologies Ernst-Frey-Straße 9 · DE-76135 Karlsruhe schmidt.christ...@1und1.de Amtsgericht Montabaur / HRB 6484 Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver Mauss, Jan Oetjen Aufsichtsratsvorsitzender: Michael Scheeren ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ qooxdoo-devel mailing list qooxdoo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel