GXT Form AutoFocus

I have a login form and want it focus on the username textfield when it loads.
The solution is very simple, just need to set an event (onFocus) for the container.


 addListener(Events.OnFocus, new Listener<ComponentEvent>() {
    public void handleEvent(ComponentEvent e) {
        txtFldUsername.focus();
    }
});


Source : http://code.google.com/p/topcat/source/browse/trunk/Code/TopCAT/src/main/java/uk/ac/stfc/topcat/gwt/client/widget/LoginWidget.java?r=74

0 comments:

 
Copyright © peyotest