Do you have a corresponding field in your UIBinder ui.xml with the
same ui:field property?

For example, in your ui.xml you should have:

<g:Button ui:field="button">Click Me</g:Button>

In the corresponding Java class you should have:

@UiField
Button button;

@UiHandler("button")
void clickButton(ClickEvent e) {
    Window.alert("Hello World");
}


As Steve said, the method name on the UiHandler can be anything. The
parameter to the method determines the event being handled. As long as
your ui:field property, the variable name on the UIField, and the
quoted text on the @UiHandler annotation match everything should work
fine.


On Sep 8, 6:55 am, Volker <volker.kinderm...@googlemail.com> wrote:
> I try to get a button working using UiBinder with UiHandler.
> Unfortunately the screen shows up fine but the button does not react
> on any clicks. While searching for some good examples how to use the
> UiHandler annotation I got confused.
>
> The tutorial on the official gwt site says:
> @UiHandler("button")
> void handleClick(ClickEvent e) {
>     Window.alert("Hello, AJAX");}
>
> http://code.google.com/intl/de-DE/webtoolkit/doc/latest/DevGuideUiBin...
>
> The UiHandler Java doc point to some test code telling me:
> @UiHandler({"buttonClick", "labelClick"})
> void doClick(ClickEvent event) {
>     eventMessage(event);
>
> }
>
> http://code.google.com/p/google-web-toolkit/source/browse/releases/2....
>
> Searching this group I got totaly lost, because it looks like some
> implicit naming convention:
> @UiHandler("lastName")
> void onLastNameBlur(BlurEvent event) {
>   // code from UpperCase goes here}
>
> http://groups.google.com/group/google-web-toolkit/browse_thread/threa...
>
> Thanks in advance for any clarification.

-- 
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-toolkit@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.

Reply via email to