1. #1
    Sencha User
    Join Date
    Aug 2008
    Posts
    226
    Vote Rating
    2
    TheBuzzer is on a distinguished road

      0  

    Default Answered: Focusing on textfield

    Answered: Focusing on textfield


    I am trying to make a textfield get focus when it is first shown. Trying to make a window that is a login form, however if I try doing show() and than focus() on the textfield object it does not focus. I even have usernamefield.setSelectOnFocus(true). I am guessing it is not rendered yet, however I am not sure when is the field rendered for me to be able to focus.

  2. Try using a scheduler to set the focus on that field, like this:

    Code:
    Scheduler.get().scheduleDeferred(new Command() {
            @Override
            public void execute() {
                textField.focus();
            }
      });
    This way is only gets run after the browser event loop returns.

  3. #2
    Ext GWT Premium Member lefke123's Avatar
    Join Date
    Dec 2011
    Location
    Belgium
    Posts
    77
    Answers
    2
    Vote Rating
    3
    lefke123 is on a distinguished road

      0  

    Default


    Try using a scheduler to set the focus on that field, like this:

    Code:
    Scheduler.get().scheduleDeferred(new Command() {
            @Override
            public void execute() {
                textField.focus();
            }
      });
    This way is only gets run after the browser event loop returns.

Thread Participants: 1