I started playing with UiBuilder this evening and I love it, thanks
Google!

I was working through the examples on
http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Overview

In the third code block down we see this:
  HelloWorld helloWorld = new HelloWorld();
  Document.get().getBody().appendChild(helloWorld.getElement());
... which works fine.

Later there is an example with a button that you can click and
apparently the event handling is magically done like this:
   @UiHandler("button")
   void handleClick(ClickEvent e) {
      Window.alert("Hello, AJAX");
   }

Clicking the button does nothing! It had me stumped for a while. I
found a few comments in the group saying it wasn't working. Then I
remembered that GWT has a "different" way of handling events other
than hooking onto raw elements, so of course this won't work:
   Document.get().getBody().appendChild(helloWorld.getElement());
The solution is to use:
   RootPanel.get().add(helloWorld);

Obvious now!

Paul S

-- 
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