Milan Cvejic | 5 Jul 01:05 2011
Picon

Removing ClickHandler from Button?

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

Rob Coops | 5 Jul 01:14 2011
Picon

Re: Removing ClickHandler from Button?

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 <liquidbrainz <at> 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() {
    <at> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe <at> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Milan Cvejic | 5 Jul 02:03 2011
Picon

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

Mauro Bertapelle | 5 Jul 08:55 2011
Picon

Re: Removing ClickHandler from Button?

use the HandlerRegistration returned from Button.addClickHandler

On 5 Lug, 02:03, Milan Cvejic <liquidbra...@...> wrote:
> 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...@...> 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...@...> 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() {
> > >     <at> 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 <at> googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-web-toolkit+unsubscribe@...
> > > 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@...
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Milan Cvejic | 5 Jul 21:56 2011
Picon

Re: Removing ClickHandler from Button?

Thanks for answer.

Cheers

On Jul 5, 8:55 am, Mauro Bertapelle <mauro.bertape...@...>
wrote:
> use the HandlerRegistration returned from Button.addClickHandler
>
> On 5 Lug, 02:03, Milan Cvejic <liquidbra...@...> wrote:
>
> > 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...@...> 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...@...> 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() {
> > > >     <at> 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 <at> googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > google-web-toolkit+unsubscribe@...
> > > > 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@...
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Gmane