Button#addClickHandler uses #addDomHandler which calls #sinkEvents to start receiving events. If only addHandler is called, the button will not start receiving the vent.
On Fri, Dec 28, 2012 at 10:15 PM, Atul Acharya <a885.a242...@gmail.com>wrote: > I am trying to use method addHandler on a Button. Following is my code: > > private void attachClickHandler(Widget widget) { > ClickHandler clickHandler1; > ClickHandler clickHandler2; > > clickHandler1 = new ClickHandler() { > > @Override > public void onClick(ClickEvent event) { > System.out.println("ClickHandler One"); > } > > }; > clickHandler2 = new ClickHandler() { > > @Override > public void onClick(ClickEvent event) { > System.out.println("ClickHandler Two"); > } > > }; > ((Button) widget).addClickHandler(clickHandler1); > widget.addHandler(clickHandler2, ClickEvent.getType()); > } > > > > If I add both handlers, it works perfectly. But if I try to add only > clickHandler2 (with widget.addHandler(...), then the handler is not called. > > > > Not able to figure out why? > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-web-toolkit/-/TlqpQoDhr3sJ. > To post to this group, send email to google-web-toolkit@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. > -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.