I have a piece of GWT code that I wanted to invoke from outside handwritten 
JavaScript. There's an example shown here under "Calling a Java method from 
Handwritten JavaScript":
https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsJSNI

That example uses a static method; I can make that work, but my first 
instinct was that i'd rather use an instance, so using the syntax shown 
under JSNI invocations, I tried:

/* package */ native void exportJavascriptMethods( PreviewPane x ) /*-{
       $wnd.imageSelected =
          $entry(this
@ca.cpp.spike.gwtapplet.client.PreviewPane::imageSelected
(Ljava/lang/String;Ljava/lang/String;));
  }-*/;

That doesn't work. Eclipse (and the GWT compiler) complain:
"JavaScript parsing: Missing ) after argument list PreviewPane.java"

If I replace 'this' with 'x', same problem. If I take 'this' out and leave 
it binding to the static method:

/* package */ native void exportJavascriptMethods( PreviewPane x ) /*-{
       $wnd.imageSelected =
          $entry(@ca.cpp.spike.gwtapplet.client.PreviewPane::imageSelected
(Ljava/lang/String;Ljava/lang/String;));
  }-*/;


All is well in the world.

So -- is that just not an option, exporting an instance method like that?

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/mC9EADg67lcJ.
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