java - Add a click handler to a HorizontalPanel in GWT -


how add click handlers horizontalpanel?

it worked use of adddomhandler() in newer gwt versions, had downgrade gwt 2.0.4 isn't supported. used this:

horizontalpanel.getwidget(1).adddomhandler(someclickhandler,clickevent.gettype()); //or horizontalpanel.adddomhandler(someclickhandler, clickevent.gettype()); 

use focuspanels instead of hooking native events. catch clicks whole panel:

focuspanel wrapper = new focuspanel(); horizontalpanel panel = new horizontalpanel(); wrapper.add(panel); wrapper.addclickhandler(new clickhandler() {   @override   public void onclick(clickevent event) {     // handle click   } });  // add wrapper parent widget held panel. 

or catch clicks inside cell in horizontalpanel:

iswidget child; // widget horizontalpanel panel = new horizontalpanel(); focuspanel clickbox = new focuspanel();  clickbox.add(child); panel.add(clickbox);  clickbox.addclickhandler(...); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -