Heres my example (a custom widget): public class TestWidget extends Composite {
private static TestWidgetUiBinder uiBinder = GWT .create(TestWidgetUiBinder.class); interface TestWidgetUiBinder extends UiBinder<Widget, TestWidget> { } @UiField Button button; public TestWidget(String firstName) { initWidget(uiBinder.createAndBindUi(this)); button.setText(firstName); super.onAttach(); } @UiHandler("button") void onClick(ClickEvent e) { Window.alert("Hello!"); } } And here the code to add the Widget to a Panel: TestWidget testWidget = new TestWidget("myTestWidget"); RootPanel.getBodyElement().appendChild(testWidget.getElement()); mainPanel.getElement().appendChild(testWidget.getElement()); I know that it is possible to add an Widget directly to an RootPanel like this: RootPanel.get("myId").add(testWidget ); However lets say i want to add widgets directly to the DOM. I don't really understand why i have to call super.onAattch(); to get my ClickEvent to work. If i don't execute that line it won't fire. I'm not sure if this is the right way maybe somebody can give me more information. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.