Wednesday, June 23, 2010

Re: Pass a method as parameter in GWT

keep cool ;)

You can pass a Runnable (Command) as parameter ... like a clikHandler 



On Wed, Jun 23, 2010 at 4:29 PM, Thiago Miranda de Oliveira <thiagomir@gmail.com> wrote:
Plz, someone?

On Jun 23, 10:45 am, Thiago Miranda de Oliveira <thiago...@gmail.com>
wrote:
> Hi.
> Im building a logic here that a class A instantiate a object of
> another class B. B has a specified clickHandler that does a animation.
> I want that the class A can pass a method to the class B as a
> parameter to do the animation and some extra stuff that I wanna do in
> the class A.
> So I was thinking in something like that:
>
> class A
> Button trigger = new Button();
> trigger.addClickHandler(new ClickHandler(){
>  //doStuff
>  callBack();
>
> }
>
> class B
> A a = new A();
> a.setCallBack(doThis());
>
> public void doThis(){
>  Window.alert("test");
>
> }
>
> How can I do that in GWT?
>
> Thanks for the attention
> Cheers

--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
"Computers are useless. They can only give you answers."
- Pablo Picasso -

--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment