I also made the mistake you describe : root.getElement().appendChild( widget.getElement() );
Using root.addWidget( widget ) as replacement doesn't fixes the event handler issue :'( On 22 déc, 14:34, Joel Webber <[email protected]> wrote: > Weird. Can you send a sample? > > One other thing to consider -- you haven't by any chance attached the widget > to the document body directly, like this, have you? > Document.get().getBody().appendChild(myWidget.getElement()); > > I know it sounds a bit strange, but this pops up fairly often. It will cause > events to break because the widgets all see themselves as unattached, and > thus never hook up their event handlers. > > On Tue, Dec 22, 2009 at 2:46 AM, nicolas.deloof > <[email protected]>wrote: > > > > > You're right, this works fine > > > just still can't have handlers working with my button, either using > > @UiHandler( "subscribe" ) or a programmatic subscribe.addClickHandler > > (...) > > strange ... any suggestion to debug this ? > > > On 21 déc, 16:03, Joel Webber <[email protected]> wrote: > > > To be precise, you don't actually need the <g:HTML> in this example. It > > > could be simply: > > > > <g:HTMLPanel tag="li" styleName="{style.event}"> > > > <div> > > > ... static HTML code ... > > > <g:Button>You can do this too</g:Button> > > > </div> > > > <g:Button > > > ui:field="subscribe" styleName="{style.button}">Inscription</g:Button> > > > </g:HTMLPanel> > > > > The point of the HTMLPanel/Parser is that it allows you to mix static > > HTML > > > and widgets more or less arbitrarily. We've also seen that many designs > > can > > > end up with a lot fewer unnecessary widgets this way. > > > > On Mon, Dec 21, 2009 at 3:34 AM, nicolas.deloof < > > [email protected]>wrote: > > > > > Do you suggest that extending Widget woul allow to mix HTML and <g:*> > > > > tags in the ui.xml file as I did first ? If I understand well what > > > > happens in the Deferred binding any <g:*> is converted to gwt API > > > > calls to assmble widgets and pannel together, and static HTML have to > > > > be placed into <g:HTML> elements, isn't it ? > > > > > Anyway it would be cool to be able to mix pure HTML and <g:*> > > > > component, something similar to Apache Wicket inside GWT :) > > > > > I fixed my widget using this layout : > > > > > <g:HTMLPanel tag="li" styleName="{style.event}"> > > > > <g:HTML> > > > > ... static HTML code ... > > > > </g:HTML> > > > > <g:Button ui:field="subscribe" > > > > styleName="{style.button}">Inscription</g:Button> > > > > </g:HTMLPanel> > > > > > With @UiField Button subscribe; > > > > the �...@uihandler( "subscribe" ) public void handleClick( ClickEvent > > > > e ) doesn't work anyway. Just not getting into code when the button is > > > > clicked. Have to investigate more on that. > > > > > I tried to extend Widget as you suggested but makes no change. > > > > > Nicolas > > > > > On 20 déc, 21:34, Ray Ryan <[email protected]> wrote: > > > > > EventWidget must extend Widget, and it will have to be placed in a > > panel > > > > > whose ultimate ancestor is either a RootPanel or a RootLayoutPanel > > > > > > On Mon, Dec 21, 2009 at 5:24 AM, nicolas de loof > > > > > <[email protected]>wrote: > > > > > > > Hi > > > > > > > I've migrated some nice HTML/CSS code to uibinder, and would like > > now > > > > to > > > > > > listen to clickEvents on the <button> present in this HTML > > fragment. > > > > > > > according to > > >http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideUiBin.. > > > > ., > > > > > > I need to use a gwt:Button as replacement for the html element to > > > > support > > > > > > GWT event handlers. I tried to use it as is, to wrap all my bloc > > inside > > > > > > <gwt:HTML> and other ideas, but allways fail with some > > deferedBinding > > > > errors > > > > > > > Any suggestion ? > > > > > > > Here is my widget ui.xml : > > > > > > > <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" > > > > > > xmlns:g="urn:import:com.google.gwt.user.client.ui" > > > > > > > <ui:style> > > > > > > ... > > > > > > </ui:style> > > > > > > > <li class="{style.event}"> > > > > > > ... (some nice HTML code) > > > > > > <button ui:field="subscribe" > > > > > > class="{style.button}">Inscription</button> > > > > > > </li> > > > > > > > </ui:UiBinder> > > > > > > > and java : > > > > > > > public class EventWidget > > > > > > extends UIObject > > > > > > { > > > > > > interface MyUiBinder > > > > > > extends UiBinder<LIElement, EventWidget> > > > > > > { > > > > > > } > > > > > > > @UiField > > > > > > // ButtonElement subscribe; > > > > > > Button subscribe; > > > > > > > @UiHandler( "subscribe" ) > > > > > > public void handleClick( ClickEvent e ) > > > > > > { > > > > > > ... > > > > > > > -- > > > > > >http://groups.google.com/group/Google-Web-Toolkit-Contributors > > > > > -- > > > >http://groups.google.com/group/Google-Web-Toolkit-Contributors > > > -- > >http://groups.google.com/group/Google-Web-Toolkit-Contributors -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
