hi andrey,
i usually use this trick when deal with this reference inside method


class PageToolbar extends PagingToolbar {
private native void patch() /*-{
       var dummyThis=this;
       var pagingToolbar =
[email protected]::getOrCreateJsObj()();

       pagingToolbar.field.on("keydown", function(e) {
               alert("1");
               *[email protected]::mymethod()();
               alert("2");
       }, pagingToolbar);
}-*/;
private void mymethod() {
 ...
}
}



it's work for my jsni call


On Mon, Mar 2, 2009 at 7:42 AM, Shawn Brown <[email protected]>wrote:

>
> HI,
>
> > Is there any way I can access enclosing "this"
> > instance (that would be PageToolbar)?
>
> Pass it in, and call your method. It works for me.
>
> patch(this);  //method call
>
> class PageToolbar extends PagingToolbar {
> private native void patch(PageToolbar pt) /*-{  /class of whatever
> gets passed in
>       var pagingToolbar =
> [email protected]::getOrCreateJsObj()();
>
>       pagingToolbar.field.on("keydown", function(e) {
>               alert("1");
>               [email protected]::mymethod()();
>                alert("2");
>       }, pagingToolbar);
> }-*/;
> private void mymethod() {
>  ...
> }
> }
>
> >
>

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

Reply via email to