Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Problem with focusInItem

    Hi all,
    I'm facing a problem with focusInItem(). In my page I have a TextAreaItem TA and below that 5 TextItems T1,T2,T3,T4 and T5.
    In the KeyPressHandler of TA I want to set focus on T1 that means I want set the cursor in T1. I used the code like :
    TA.addKeyPressHandler(new KeyPressHandler() {
    @Override
    public void onKeyPress(KeyPressEvent event) {
    if (event.getKeyName().equals(KeyNames.TAB)) {
    T1.focusInItem();
    }
    }
    });
    But the focus is not set in T1 instead it is setting on T2. If I use T2.focusInItem() in the KeyPressHandler , the focus is not set in T2 and it is setting on T3. I can't remove TextAreaItem and of course I want to set the KeyPressHandler in TextAreaItem. I need help.

    #2
    Sounds like the focus does get to T1, after it leaves TA, but the tab event carries into T1, so you end up at T2. Maybe try add a event.cancel() before you call T1.focusInItem?

    Comment


      #3
      Thanks Sunnyl..... It worked.....................

      Comment

      Working...
      X