use RootPanel or RootLayoutPanel and add your widget to it.

On Tue, Jul 19, 2011 at 8:40 PM, Matt <[email protected]> wrote:

> I am trying to add events to a Button using the UiBinder, but nothing
> is happening when I click the Button. Here is my code:
>
> Login.ui.xml:
> <ui:UiBinder
>  xmlns:ui="urn:ui:com.google.gwt.uibinder"
>  xmlns:g="urn:import:com.google.gwt.user.client.ui" >
>
>        <g:HTMLPanel>
>                <g:Button ui:field="button">test</g:Button>
>        </g:HTMLPanel>
> </ui:UiBinder>
>
> Login.java:
> package com.company.client.view;
>
> import com.google.gwt.core.client.GWT;
> import com.google.gwt.event.dom.client.ClickEvent;
> import com.google.gwt.uibinder.client.UiBinder;
> import com.google.gwt.uibinder.client.UiField;
> import com.google.gwt.uibinder.client.UiHandler;
> import com.google.gwt.user.client.ui.Button;
> import com.google.gwt.user.client.ui.Composite;
> import com.google.gwt.user.client.ui.Widget;
>
> public class Login extends Composite {
>        interface LoginUiBinder extends UiBinder<Widget, Login> { }
>        private static LoginUiBinder uiBinder =
> GWT.create(LoginUiBinder.class);
>        @UiField Button button;
>
>        public Login() {
>                initWidget(uiBinder.createAndBindUi(this));
>        }
>        @UiHandler("button")
>        void onButtonClick(ClickEvent event) {
>                Window.alert("test");
>                button.setSize("200px", "300px");
>        }
> }
>
> Entry.java:
> package com.company.client.presenter;
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.dom.client.Document;
> import com.presto.client.view.Login;
>
> public class Entry implements EntryPoint {
>
>        @Override
>        public void onModuleLoad() {
>                Login l = new Login();
>                Document.get().getBody().appendChild(l.getElement());
>        }
>
> }
>
> ....
> The button correctly shows on the page, but there is no click event.
> I am new to GWT, so I'm not sure what else I'm missing.  Any ideas?
> Thanks.
>
> --
> 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.
>
>

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