LOL Thanks Ian worked fine :)

On Jan 17, 5:51 pm, Ian Bambury <[email protected]> wrote:
> Something like this?
>
> import com.google.gwt.event.dom.client.ClickEvent;
> import com.google.gwt.event.dom.client.ClickHandler;
> import com.google.gwt.user.client.Window;
> import com.google.gwt.user.client.ui.HTML;
> import com.google.gwt.user.client.ui.RootPanel;
>
> public class App implements ClickHandler
> {
>     public void onModuleLoad()
>     {
>         ListLink link = new ListLink("Click Here");
>         link.addClickHandler(this);
>         RootPanel.get().add(link);
>     }
>
>     class ListLink extends HTML
>     {
>         public ListLink(String text)
>         {
>             setHTML("<li>" + text + "</li>");
>         }
>     }
>
>     @Override
>     public void onClick(ClickEvent event)
>     {
>         Window.alert("Clicked");
>     }
>
> }
>
> On 17 January 2011 17:31, julio <[email protected]> wrote:
>
> > Hi Thomas,
>
> > yes you are right, in that case my widget is "out of sync" with the
> > DOM.
>
> > do you mean to replace this:
>
> > getElement().appendChild(a.getElement());
>
> > with something else? If it's so how? I can't find any API for that
> > case (not even this.addWidget(...))
>
> > Thanks,
> > Julio
>
> > On Jan 17, 3:55 pm, Thomas Broyer <[email protected]> wrote:
> > > On Monday, January 17, 2011 4:02:08 PM UTC+1, julio wrote:
>
> > > > getElement().appendChild(a.getElement());
>
> > > event handlers are "bound" when the *widget* is *attached* (i.e. somehow
> > its
> > > onAttach method is called). In short, never use getElement() unless you
> > know
> > > what you're doing (particularly when dealing with DOM tree
> > manupulations),
> > > always use widget methods addWidget() et al.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-web-toolkit%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to