Fabian Jakobs wrote:
> 
> I usually use qx.lang.Function.bind:
> 
> for( var key in data )
> {
>   var button = new qx.ui.form.Button( data[key].label );
>   vbox.add(button);
>   
>   // this doesn't work
>   button.addListener("execute", qx.lang.Function.bind(function(key){
>     alert("Good:" + data[key].label);
>   }, this, key));
> }
> 
> This creates a wrapped function in place and binds the first parameter 
> to the current value of key.
> 

Cool, that's exactly what I need. Thanks for all the suggestions - I'll pick
the most qooxdoo'ish. Maybe a good addition to the snippet section. 

Thanks, 
Christian
-- 
View this message in context: 
http://n2.nabble.com/Getting-an-iterated-local-variable-into-a-closure-tp3889573p3891385.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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