You were both right, it was a problem of context:

**** original code *****

// inside an object constructor

.....

luogoCercaButton.addListener("click", function(e) { 
        var address = luogoCercaTextField.getValue();
 
        geocoder.getLocations (address, this._pluto); 
}, this);

.....

members : { 
   _pluto : function () 
   { 
      ... 
      this._pippo(); 
      ... 
   }, 

   _pippo : function () 
   { 
      ... 
   } 
}

so I did this modification and now it's workin:

var obj = this;

luogoCercaButton.addListener("click", function(e) { 
        var address = luogoCercaTextField.getValue();

        geocoder.getLocations (address, geoCallback); 
}, this);

function geoCallback (response){ 
        obj.__pluto(response);
}


Is there a way to do this in a more clean way?

Thank you for help!

Garofoli Group
ANDREA GIAMPIERI
Ufficio C.E.D.
Tel:  +39 071 72717703 
E-mail: [email protected]
Web: www.gidea.it | Web: www.garofoli.com 



"Noggin182 (via Nabble)" <[email protected]> 
30/04/2009 14.53
Per favore, rispondere a
Post 2746897 on Nabble <[email protected]>


Per
portableJesus <[email protected]>
CC

Oggetto
Re: [qooxdoo-devel] Simple question on methods






Hi, 

portableJesus wrote: 
> I'm new to OO Javascript, so please have a little patience :) 
Welcome to the project! You're not alone there, I spent a couple years 
thinking I was quote JavaScript savy before I discovered OO JavaScript. 

> What I'm doing wrong? 
There isn't anything wrong with the code that you have provided. It is 
more likely a problem in the way you are calling _pluto, or in the code 
around the call to _pippo. 


> members : { 
>    _pluto : function () 
>    { 
>       ... 
>       this._pippo(); 
>       ... 
>    }, 
> 
>    _pippo : function () 
>    { 
>       ... 
>    } 
> } 
> 
> Result: 
> 
> this._pippo is not a function 

It might be the case that you are calling this._pippo() inside an event 
handler but haven't set the context correctly, or (as Jean-Noël 
suggested) you are trying to call a function dirrectly rather than 
creating an instance of the class first. If you could provide more code 
that we should be able to help you better. 

> Thank u for help 

HTH, 
Matt 


------------------------------------------------------------------------------ 

Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________ 
qooxdoo-devel mailing list 
qooxdoo-de...@... 
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


This email is a reply to your post @ 
http://n2.nabble.com/Simple-question-on-methods-tp2741054p2746897.html
You can reply by email or by visting the link above.


 

Gli allegati e le informazioni contenute nella presente possono essere 
riservate e sono destinate alle persone/Società sopraindicate. La 
diffusione/copiatura del documento trasmesso da chiunque diverso dal 
destinatario è proibita, (art. 616 c.p. e D.Lgs. 196/03). Se avete 
ricevuto questo messaggio per errore, vi preghiamo di distruggerlo e di 
informarci immediatamente. The included files and information in this 
e-mail are confidential and may also be legally privileged. It is intended 
for the addressee only. Access to this e-mail by anyone else is 
unauthorised. If you have received this e-mail in error please notify us 
immediately, destroy any copies and delete it from your computer system.


This Email is secured by Fastnet Securemail
-- 
View this message in context: 
http://n2.nabble.com/Simple-question-on-methods-tp2741054p2746982.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to