I have just looked at the docs for GClientGeocoder.getLocations (which 
is what I assume you are using) and it doesn't appear to be able to take 
a context parameter, although I would have though it should have worked 
without one.

The workaround you provided is the way to go. There are a couple of 
variations on that you could do.

1.) Make the function annonymous

var obj = this;
...
geocoder.getLocations(address, function(response) {obj._pluto(response)});

2.) Use qx.lang.Function.bind. This will make a little more overhead though

geocoder.getLocations(address, qx.lang.Function.bind(obj._pluto, obj));



portableJesus wrote:
> 
> 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: a.giampi...@... 
> <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2746982&i=0>
> Web: _www.gidea.it_ <http://www.gidea.it> | Web: _www.garofoli.com_ 
> <http://www.garofoli.com>
> 
> 
> *"Noggin182 (via Nabble)" <ml-user+38663-1243428...@... 
> <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2746982&i=1>>*
> 
> 30/04/2009 14.53
> Per favore, rispondere a
> Post 2746897 on Nabble <ml-node+2746897-1365726...@... 
> <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2746982&i=2>>
> 
> 
>       
> Per
>       portableJesus <a.giampi...@... 
> <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2746982&i=3>>
> 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...@..._ 
> <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=2746897&i=0> _
> __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_ <http://www.fastnet.it>
> 
> ------------------------------------------------------------------------
> View this message in context: Re: [qooxdoo-devel] Simple question on 
> methods 
> <http://n2.nabble.com/Simple-question-on-methods-tp2741054p2746982.html>
> Sent from the qooxdoo mailing list archive 
> <http://n2.nabble.com/qooxdoo-f678.html> 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


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