PDA

View Full Version : how to add Header click event Listener



mamatachaudhari
28 Mar 2011, 1:47 AM
Hi,
my code is



contentPanel.getHeader().addListener(Events.OnClick, new Listener<ComponentEvent>(){
public void handleEvent(ComponentEvent be)
{

HorizontalPanel contentPanel = (HorizontalPanel )be.getSource().getParent();
System.out.println("In listener ===="+contentPanel);



 
}
});



But after clicking on header nothing is happening....
Could any one please tell me where is exact problem.
I tried Events.HeaderClick also but no luck.
Give me any solution

informer1985
4 Apr 2011, 12:04 AM
Use BaseEvent instead of ComponentEvent:


ContentPanel cp = new ContentPanel();
cp.getHeader().addListener(Events.OnClick, new Listener<BaseEvent>() {

@Override
public void handleEvent(BaseEvent be) {
Info.display("Test Title", "Test Content");
}
});

RootPanel.get().add(cp);

bogusky
5 Apr 2011, 8:56 AM
contentPanel.getHeader().sinkEvents(Event.ONCLICK);
contentPanel.getHeader().addListener(Events......

sven
5 Apr 2011, 9:12 AM
Since GXT 2.2 the browser event gets automatically sunk.