Hi, thanks, the mechanism is still too new for me. Now, after debugging exactly what Thomas said (the return val was empty), I understand it.
So one can never just fetch something from the server while being in a process where the server's result is needed. Good example! :-) Magnus On 16 Jun., 14:52, aditya sanas <[email protected]> wrote: > LOL Thomas.[?] > > That was great example to determine async calls. > > anyway what you are saying is right. > > Its a bad design to have a method which returns something and then make > async call which > > changes the state of some variable. > > -- > Aditya > > > > On Wed, Jun 16, 2010 at 6:13 PM, Thomas Broyer <[email protected]> wrote: > > > On Jun 16, 1:09 pm, Magnus <[email protected]> wrote: > > > Hi, > > > > because I cannot access a variable in the enclosing block from within > > > an AsyncCallback method I found the following workaround with a class > > > global variable, which I find very unpretty. How can one do this > > > better? > > > What is it that you don't understand in "asynchronous"? > > > I mean, your getUsr call will *always* end after the "return > > tmp_str_usr" statement. So, on the first call and until the server > > responds and you AsyncCallback is called, you'll get the empty string > > (initial value of the field); then AsyncCallback will change its > > value, and on all subsequent calls until the server responds to the > > new requests (and AsyncCallback will be called again) you'll get that > > value. > > > When you ask your wife to get you some beer, the beer won't be there > > until your wife come back from the kitchen; and while she's gone, the > > football match isn't paused and life continues. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-web-toolkit%2bunsubs[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-web-toolkit?hl=en. > > > > 360.gif > < 1 KBAnzeigenHerunterladen- Zitierten Text ausblenden - > > - Zitierten Text anzeigen - -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
