Post new topic Reply to topic  [ 3 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Discussion

Author Message
 Post subject: [SOLVED] Clicklistener for panel
PostPosted: Wed Mar 26, 2008 9:00 am 
Offline

Joined: Wed Feb 13, 2008 10:07 am
Posts: 19
Is there a way to add a clicklistener to a panel? Right now I only see container and panel listeners, none of which have the onClick event.

What I'm trying to do is the following:
Code:
Panel panel = new Panel();
panel.setHTML("<a href ....>blah</a>");
panel.addClickListener(the click listener(){
onClick(){
    Change color of panel and respond to click
}
}


Cheers!
Hugo

_________________
Cheers,
Hugo


Last edited by hugoforte on Fri Mar 28, 2008 8:22 am, edited 1 time in total.

Back to top
 Profile WWW 
 
 Post subject: Re: Clicklistener for panel
PostPosted: Fri Mar 28, 2008 8:01 am 
Offline

Joined: Mon Mar 10, 2008 7:21 am
Posts: 202
Try this:
Code:
panel.addListener(new ContainerListenerAdapter(){
   public void onRender(Component component) {
      panel.getEl().addListener("click", new EventCallback(){
         public void execute(EventObject e) {
            MessageBox.alert("Panel clicked");
         }   
      });
   }
});

Change the event from "click" to "contextmenu" if you want to do stuff on right click.

Btw,
Code:
panel.addListener("click", new Function() {
   public void execute() {
      MessageBox.alert("Panel clicked");
   }
});

doesn't handle the click event. Anyone knows why?

_________________
Gwt-Ext docs: http://gwt-ext.com/docs/2.0.4/
Your question may have been answered already: viewforum.php?f=9


Last edited by abhijeet.maharana on Fri Mar 28, 2008 11:54 am, edited 1 time in total.

Back to top
 Profile  
 
 Post subject: Re: Clicklistener for panel
PostPosted: Fri Mar 28, 2008 8:21 am 
Offline

Joined: Wed Feb 13, 2008 10:07 am
Posts: 19
Sweet! That works just fine! That will solve quite a few workarounds I've had to put in place.

Cheers!!

_________________
Cheers,
Hugo


Back to top
 Profile WWW 
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

Board index : GWT-Ext Forums : GWT-Ext 2.x Discussion


Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Style by Midnight Phoenix & N.Design Studio
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.