You can also bind your function. So where this won't work:

this.rpc.callAsync(this._handleResult);

You can do this:

this.rpc.callAsync(qx.lang.Function.bind(this._handleResult, this));

That should help keep your code tidy :)
Matt

JB wrote:
> Thanks, I got it.  I am familiar with them from the LISP and Scheme 
> languages but I was not familiar with the scoping rules in javascript.  
> In the function that calls this.rpc.callAsync I create  local variable 
> with a value of this.selectBoxControl like so:
> 
>       var selBox = this.selectBoxControl;
>       this.rpcRef = this.rpc.callAsync(function(result, ex, id) {
>               if (ex == null) {
>                   selBox.removeAll();
>                    // whatever else to do on success
>              } else {
>                 // handle exception code
>              }
>        }
> 
> 
> 
> Derrell Lipman wrote:
>> On Sat, Oct 24, 2009 at 03:10, JB <[email protected] 
>> <mailto:[email protected]>> wrote:
>>
>>     Thanks!!! That did the trick. However, I think I might have found
>>     a case
>>     where that does not work so well. The button event listeners work
>>     great!
>>     But I also have an RPC callback as well and there are an arbitrary
>>     number of arguments to callAsync that are passed to the remote
>>     procedure. Simply passing in 'this' as the last argument doesn't
>>     seem to
>>     quite work. So how can I make this work with rpc.callAsync?
>>
>> When it's not feasible to retain the values that you need to work with 
>> in the object associated with 'this' in the handler (which is the case 
>> for rpc), you can use JavaScript closures. If you're not familiar with 
>> closures, study it and if you still have questions, ask questions 
>> here. They are very powerful and highly useful for this sort of thing.
>>
>> Cheers,
>>
>> Derrell
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay 
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>   
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to