I have a GWT horizontal panel, which I have styled to make it look like a custom div with a given height and width (using raw HTML is no-no for me here). Now I want to attach a clickhandler to it. How do I do it?
Doing something like mypanel.addClickHandler() {} is throwing an error stating that I can’t attach such event to a panel. Same goes for mypanel.getElement().addClickHandler() {}. Is there any way to attach clickhandler, keyuphandler etc to elements and panels, i.e which are not buttons?
You should use FocusPanel which adds the ability to catch mouse and keyboard events. You can add your
HorizontalPanelto aFocusPaneland then add the required event handlers.