• Post Reply Bookmark Topic Watch Topic
  • New Topic

SWT setFocus doesn't work

 
Rudolfoo Schmidt
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JFace TitleAreaDialog with several Text widgets. A FocusListener on these Text widgets checks on FocusLost, if the input is valid e.g. a String value. If validation fails, an error message is printed.
I would like to have the focus back in field that failed to validate. I tried:
Text text = (Text) focusEvent.getSource();
text.setFocus();

This doesn't work, does anybody knows why? What else can I do, to remain in a Text widget, if a validation failed?

Thanks,
Rudolf
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!