Thanks. I see now that this is discussed in the GWT FAQ and I
understand why my attempt at using "this" in a callback doesn't work.


On Wed, Apr 22, 2009 at 7:17 PM, Thomas Broyer <t.bro...@gmail.com> wrote:
>
>
>
> On 21 avr, 04:21, jrray <jrobert...@gmail.com> wrote:
>>
>> This technique would be more convenient if "doLogin" wasn't a static
>> method.
>>
>> I tried to change to non-static, such as:
>>
>>    private native void injectLoginFunction() /*-{
>>       $wnd.__gwt_login = th...@com.example.myapp.client.app::doLogin
>> ();
>>    }-*/;
>
> var that = this;
> $wnd.__gwt_login = function() {
>    th...@com.example.myapp.client.app::doLogin()();
> }
>
> or change the method's signature:
> private native void injectLoginFunction(App that) /*-{
>    $wnd.__gwt_login = function() {
>        th...@com.example.myapp.client.app::doLogin()();
>    }
> }-*/;
> and call it like that:
>    injectLoginFunction(this);
>
> That's "JSNI 101" ;-)
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to