Tuesday, September 28, 2010

Re: How to add click handler to a panel?

If you are willing to wait till 2.1 or upgrade to the milestones
addHandler has been changed to public instead of protected.

On Sep 28, 4:40 pm, drthink <drgenejo...@gmail.com> wrote:
> I want to add a click handler to a panel so I extended the
> HorizontalPanel as shown below.  It feels dirty because in the
> constructor I have to register the click event but put nothing in the
> method in order for the ClickEvent to propgate to the parent control
> which registers the ClickHandler.  Is this the correct way of doing it
> or am I being a hacker?
> Cheers
> G
> public class HorizontalPanelSoho extends HorizontalPanel implements
> HasClickHandlers {
>         public HorizontalPanelSoho(){
>                 super();
>                 this.addDomHandler(new ClickHandler(){
>                         @Override
>                         //This has to be here otherwise event doesn't get passed up to the
> handler registered.
>                         public void onClick(ClickEvent event) {
>                         }
>                 }, ClickEvent.getType());
>         }
>         @Override
>         public HandlerRegistration addClickHandler(ClickHandler handler) {
>                 return addHandler(handler, ClickEvent.getType());
>         }
> }

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