I create a button within a class and return it to be displayed.  I have the
event handlers within the class definition and I'd like to be able to access
the class variables from within the handler, is this possible? 

Something like this: 

qx.Class.define("myapp.Class1", 
{ 
  extend: qx.core.Object, 
  construct: function() { }, 
  members: 
  { 
    _button: null, 
    _count: 0, 
    render : function() 
    { 
      this._button = this.makeButton(); 
      this._button.addListener("execute", this.click); 
      return this._button; 
    }, 
    makeButton : function() 
    { 
      return new qx.ui.form.Button("First Button",
"icon/22/apps/internet-web-browser.png"); 
    }, 
    click : function(e) 
    { 
      this._count++; 
      alert(this._count); 
    } 
  } 
}); 

// Document is the application root 
var doc = this.getRoot(); 

// Add button to document at fixed coordinates 
var c1 = new myapp.Class1(); 
doc.add(c1.render()); 


This should show a button that pops up an alert box with the current value
of _count each click.  In the playground, however, it just shows NaN, which,
I assume, means the event handler does not have access to class variables.



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/access-class-variables-within-event-handler-tp7583160.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to