When I try using that the myObject.addOnclick(onclick());  the function I am
trying to pass in actually executes at that time, and when I look at the
value of final JavaScriptObject func it has a value of null and then when
the button that I am trying to create is clicked the value of func is null
as well.

On Thu, Dec 3, 2009 at 2:52 PM, Thomas Broyer <t.bro...@gmail.com> wrote:

>
>
> On 3 déc, 17:34, Davidj2k <david...@gmail.com> wrote:
> > I am needing to pass a function from javascript to the java code to
> > fire an event so that when a button is created using Java I can pass
> > to it the function to call when that button is clicked, any help would
> > be greatly appreciated.
> >
> > the javascript
> >
> > function onclick()
> > {
> >      alert('I was clicked');
> >
> > }
> >
> > myObject.addOnclick(onclick());
> >
> > or it could be
> >
> > myObject.onclickevent = onclick();
> >
> > the java
> >
> > public void addOnClick(NOT SURE WHAT TO PASS HERE)
>
> public void addOnClick(final JavaScriptObject func)
>
> >         {
> >                  SelectionListener<ButtonEvent> l = new
> > SelectionListener<ButtonEvent>() {
> >                     @Override
> >                     public void componentSelected(ButtonEvent ce) {
> >                         THEN CALL THE JAVASCRIPT FUNCTION HERE
>
> callFunc(func);
>
> >                     }
> >                 };
> >         }
>
> private native void callFunc(JavaScriptObject func) /*-{
>   func();
> }-*/;
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-tool...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@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