Re: How to add click handler to a panel?

2010-09-29 Thread Thomas Broyer


On Sep 29, 12:40 am, 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 just need to call addDomHandler in addClickHandler, and remove the
call from your constructor.

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



How to add click handler to a panel?

2010-09-28 Thread drthink
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-tool...@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.



Re: How to add click handler to a panel?

2010-09-28 Thread lineman78
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-tool...@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.



How to add click handler to a panel?

2009-10-13 Thread Jie

Hi all, I want to listen to the click event for a panel, how can I
catch this event? The Panel class doesn't have such methods like
addClickHandler(). I don't want to use the sinkEvents() because in
my case I just use this field panel as a button.

Best Regards,
Jie
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How to add click handler to a panel?

2009-10-13 Thread rajkumar raj
On Tue, Oct 13, 2009 at 2:37 PM, Jie kgds...@tianya.cn wrote:


 Hi all, I want to listen to the click event for a panel, how can I
 catch this event? The Panel class doesn't have such methods like
 addClickHandler(). I don't want to use the sinkEvents() because in
 my case I just use this field panel as a button.

 Best Regards,
 Jie
 


by implementing that class ClickHandler interface you can do it.
adding the following code to ur class

 public HandlerRegistration addClickHandler(ClickHandler handler) {
return addDomHandler(handler, ClickEvent.getType());
  }

u can implement like any handlers

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