I have a link with two option edit & delete. When some one click on the link a text box appears in that text box the content of the link will be appear but i need the cursor position at the end of the text without using mouse with the help of tab index only.

final TextBox editTb = new TextBox();
editTb.addStyleName(EDIT_FAV_DELETE_STYLE);
editTb.setText(favoriteBean.getName());

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

@Override
public void execute() {
 editFavoriteTb.setFocus(true);
}
    });

Already using setFocus(true) but this showing the cursor position at the start of the text i need it at the last.

有帮助吗?

解决方案

Check this

    final TextBox editTb = new TextBox();
    editTb.addStyleName(EDIT_FAV_DELETE_STYLE);
    editTb.setText(favoriteBean.getName());

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

    @Override
    public void execute() {
     editFavoriteTb.setFocus(true);
     editTb.setCursorPos( favoriteBean.getName().length());
    }
  });
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top