PDA

View Full Version : [FIXED] focus() on textfield does not work



gslender
24 Apr 2008, 9:06 PM
Calling focus against a textfield (even in a deferred cmd) does not result in the field getting focus.

darrellmeyer
25 Apr 2008, 7:49 AM
Fixed in SVN. Thanks.

flow
27 May 2008, 4:34 AM
Hi Darrell,

Using GXT Beta 3 in hosted mode.

How am I supposed to make use of the method focus()?
I created a FormPanel and overwrote the method onRender


public LoginPanel () {
super();
...
usernameTextField = new TextField<String>();
usernameTextField.setFieldLabel(Multibase.CONSTANTS.username());
usernameTextField.setTabIndex(1);
usernameTextField.setSelectOnFocus(true);
usernameTextField.addListener(Events.KeyPress, new LoginChangeListener());
add(usernameTextField);
...
}
@Override
protected void onRender(final Element target, final int index) {
// TODO Auto-generated method stub
super.onRender(target, index);
usernameTextField.focus();
}But unfortunatelly this doesn't give the Textfield the focus when the panel is loaded. As far as I see it, the Events.Focus is handled correctly by the TextField.

I would appreciate any recommendations.
Thanks a lot,
Florian

darrellmeyer
27 May 2008, 10:40 AM
focus() can now be called before rendering. Fix is in SVN.

flow
27 May 2008, 10:37 PM
Thanks, Darrell. Will try this with the next Release.
F~