> To be able to access parent scope you are able to do like this: (just declare 
> a local variable in the function which includes your function) 
> 
> var that = this;
> var myDebug = function(p_myString) {
>       that.debug(p_myString);
>       return true;
> };
> 
> Or if you want to change the function scope / context totally: (use the bind 
> function, qooxdoo provides an polyfill for bind to support older browsers)
> 
> var myDebug = function(p_myString) {
>       this.debug(p_myString);
>       return true;
> }.bind(this);

Excellent and very elegant examples.
Very easy to understand, makes perfect sense (which, in my case, is not always 
obvious), and yet I would have never thought of such approach.
What it means is that I found them very educational.

> But my advice to you would be to declare any function in the members section 
> of qooxdoo classes. If you do so the scope is "normally" set to the class 
> instance, expect calling member functions through a callback mechanism, in 
> that case you have to set the scope manually, e.g. this.addListener("appear", 
> this._onAppear, this);
> 
> But you could re structure your code in such a way:
> ...
> members :
> {
>  main: function() {
>       this.myDebug("Indirect debug via myDebug().");
>  },
> 
>  myDebug : function(p_myString) {
>       this.debug(p_myString);
>       return true;
>  }
> }

Noted.
Thank you, Mustafa!
All your suggestions were very helpful and I truly appreciate them.


Regards,
Keve Nagy * Debrecen * Hungary


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to