Friday, June 22, 2012

TextArea.setFocus not function as expected

there is a Tree and a TextArea, when user click on the TreeItem, the TreeItem text will be copied to the TextArea, and I want the mouse cursor (focus) remain on the TextArea so when user type some text after click on the tree item, the text will be added in the TextArea.
I try to use ScheduledCommand but not work.

    dbField.addSelectionHandler(new SelectionHandler<TreeItem>(){
       public void onSelection(SelectionEvent<TreeItem> event){
            customSqlTextBox.setText(event.getSelectedItem().getText());
            Scheduler.get().scheduleDeferred(scheduleCmd);
       }
    });


private final ScheduledCommand scheduledCmd = new ScheduledCommand(){
   @Override
   public void execute(){
    customSqlTextBox.setFocus(true);
   }
};

 the result is very strange, after I click the treeitem, I see the cursor (insertion cursor) on the textarea in a very short time and then disappear, and when I type some text, the text will not be entered on the textarea.

what is the reason of this problem?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/jDxRkUscidIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate