Your issue exists because the following addEventListener call:

    execElem.addEventListener("change", handleExecFile, false);

does not set "this" for the handleExecFile function.

To get around that, you can use the qx.lang.Function.bind method (as 
Fritz suggested). Change the addEventListener line to:

    execElem.addEventListener("change", 
qx.lang.Function.bind(handleExecFile, objectThatHasTheCleanField), false);


In essence, this is the same as doing:
   execElem.addEventListener("change", function() {
     handleExecFile.apply(objectThatHasTheCleanField, arguments);
   }, false);

But the first method looks much cleaner. If you are unfamiliar with this 
technique then it might be helpful to read about the call and apply 
methods of javascript:
http://vikasrao.wordpress.com/2011/06/09/javascripts-call-and-apply-methods/


Hoping this helps.

Regards,
Marc



On 11/22/2012 07:26 AM, Fritz Zaucker wrote:
> You can use the qx....bind() function to "attach" the correct context to your 
> event handler. Something like
>
> addListener("event", qx...bind(handler,this));
>
> However, in your code you don't even pass the context to the handler 
> directly. Probably it would be sufficient to use
>
> addListener("event", handler, this);
>
> The rhird parameter (this in my example) will be used when you access this 
> inside the handler.
>
> Cheers,
> Fritz
>
> Fritz Zaucker
> Oetiker+Partner AG
> Aarweg 15
> CH-4600 Olten
> +41 62 775 9903
>
> Am 22.11.2012 um 01:22 schrieb 689137 <[email protected]>:
>
>> Marc,
>>
>> I found why _clean value is changed as I want it to be.
>> I am doing the following:
>> 1. I have a input type "execElem" in my index.html file of the qooxdoo
>> application:
>>   <input type="file" id="execElem" style="display:none">
>> 2. I get this element to the qooxdoo application as follows:
>>   var execElem = document.getElementById("execElem");
>> 3. I have a button, which I assign the click event to of this execElem when
>> it is pressed:
>>    editor.getexecButton().addListener("execute", function(e) {
>>             if (execElem) {
>>                 execElem.click();
>>                   }
>>               });
>> This button is on the panel which is in class Editor, another class declared
>> in my application.
>> 4. I assign to the change event of the execElem the following function in
>> the following way:
>>    execElem.addEventListener("change", handleExecFile, false);
>>
>>    function handleExecFile() {
>>                       //here I want to change value of this._clean
>>                         this._clean = true;
>>             }
>> In this way the value of this._clean is not true when I close the
>> application.
>> I feel that THIS is not the parent object I need, and in some way _clean is
>> not changed in the root or something like that. But please let me know what
>> I need to pass or what needs to be done in order to successfully get the
>> TRUE value of this._clean when I close the application.
>>
>> Thank you!
>>
>>
>>
>> --
>> View this message in context: 
>> http://qooxdoo.678.n2.nabble.com/Qooxdoo-Close-Event-tp7582052p7582070.html
>> Sent from the qooxdoo mailing list archive at Nabble.com.
>>
>> ------------------------------------------------------------------------------
>> Monitor your physical, virtual and cloud infrastructure from a single
>> web console. Get in-depth insight into apps, servers, databases, vmware,
>> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
>> Pricing starts from $795 for 25 servers or applications!
>> http://p.sf.net/sfu/zoho_dev2dev_nov
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to