On 15 fév, 23:31, Jim Douglas <[email protected]> wrote:
> Thanks again for your help, Thomas.  FWIW, here's the final version in
> my application code (this particular widget subclasses TextBox):
>
> In the constructor:
>         registerOnCut(getElement());
>
>     private native void registerOnCut(Element element)
>     /*-{
>         var that = this;
>         element.oncut = function()
>         {
>
> $entry([email protected]::doCut()());

You're misusing $entry here. It should "wrap" a function "reference",
so you shouldn't call doCut() and wrap its result (which would almost
be a no-op here as doCut() is void).

You'd rather write:
var that = this;
element.oncut = $entry(function() {
   [email protected]::doCut()();
   return false;
});


>From 
>http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html#calling
"""Notice that the reference to the exported method has been wrapped
in a call to the $entry function. This implicitly-defined function
ensures that the Java-derived method is executed with the uncaught
exception handler installed and pumps a number of other utility
services. The $entry function is reentrant-safe and should be used
anywhere that GWT-derived JavaScript may be called into from a non-GWT
context."""

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