Monday, July 4, 2011

Re: Removing ClickHandler from Button?

Yes, removeClickListener() is depricated, and that is why I am trying
to find solution on how to remove ClickHandler.

Just to explain my use case. I am same view with editor framework, so
I need different functionality when button is clicked.
Since button is initialized only once (in view that is constructed
only once) i need to handle event differently.

So now on start of activity i attach Listener and on stop I remove
Listener, and everything works as it should. If I don't remove
Listener, I am having
situation that event is triggered twice or more times.

I can change code to create new instance of View each time, but that
is more cpu intensive than adding and removing listeners.

Cheers.


On Jul 5, 1:14 am, Rob Coops <rco...@gmail.com> wrote:
> removeClickListner() is deprecated if I am not mistaken...
>
> Anyway the big question is why remove the clickHandler from your button in
> the first place a button that can not be clicked is nothing more then a
> label with a border...
> I would suggest disabling the button or simply have the clickHandler return
> instead of doing anything... in both cases for the user nothing will happen
> once they click the button.
>
> just my 2 cents.
>
> Regards,
>
> Rob
>
> On Tue, Jul 5, 2011 at 1:05 AM, Milan Cvejic <liquidbra...@gmail.com> wrote:
> > Hi,
> > I am trying to find a way how to remove ClickHandler from Button,
> > there is no any method related to this. I see that we can remove
> > ClickListener with removeClickListener(), but there is no way to
> > remove ClickHandler.
>
> > I am using following code:
>
> > Button b = new Button("test");
> > b.addClickHandler(new ClickHandler() {
> >    @Override
> >    public void onClick(ClickEvent event) {
> >        Window.alert("test");
> >   }
> > });
>
> > Is there any way to remove ClickHandler?
>
> > Thanks.
>
> > --
> > 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.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate