Gxt focus management

佐手、 提交于 2019-12-05 09:16:42

Based on the last response, I got this to work in a GXT3 window by doing the following:

@Override
public void show() {
    super.show();
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
        @Override
        public void execute() {
            field.focus();
        }
    });
}

This way when the window opens, the field has focus and you can begin typing.

Yusuf K.

Focus after render some delay So you have to use Scheduler.get().scheduleDeferred method. Or DeferredCommand on GWT 1.7 or before.

Example of usage:

Scheduler.get().scheduleDeferred(new ScheduledCommand() {

    @Override
    public void execute() {
        widget.focus();
        widget.el().focus();
        widget.getElement().focus();
    }
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!