Nice. Thanks Thomas. Worked great. I knew it had to be something as simple as that. Much appreciated.
On Nov 20, 4:22 am, Thomas Broyer <[email protected]> wrote: > On Nov 20, 1:07 am, Bryan <[email protected]> wrote: > > > > > I'm following the example seen here for 'calling Java methods from > > JSNI' and it works great. > > >http://googlewebtoolkit.blogspot.com/2008/07/getting-to-really-know-g... > > > I'm trying to do something slightly different though. Here's what it > > is. > > > package com.foo.bar; > > > public class MyClass { > > > private void javaMethod(String s) { > > Window.alert("called the java method with String " + s); > > } > > > private native String nativeMethod() /*-{ > > > var myFunc = function() { > > // trying to call the 'javaMethod' method from here > > and the > > notation > > // at the link above does not work > > // > > // notation that is not working for me > > // > > [email protected]::javaMethod(Ljava/lang/String;) > > ('coming from nativeMethod.myFunc'); > > } > > > }-*/; > > > } > > > It doesn't surprise me that what I'm trying doesn't work, I'm assuming > > the 'this' I'm trying to use is in the wrong scope. Anyone have any > > suggestions for how I can get to that java method from within a native > > method that defines a function? > > It's as easy as the following ;-) > > var self = this; > var myFunc = function() { > [email protected]::javaMethod(Ljava/lang/String;)('coming > from nativeMethod.myFunc'); > > }; -- 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=.
