I actually did read that section more than once, but the JSNI notes
are sparse, and there are no event handler samples.  I just
regenerated my app in detail mode to look for similar generated code,
and I do see a few, but I don't understand it.  I'll have to take this
one on faith; it's not at all clear to me what it's doing.

On Feb 15, 5:17 pm, Thomas Broyer <[email protected]> wrote:
> 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;
>
> });
>
> Fromhttp://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI...
> """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