Reputation: 1751
I am using a Table component in SWT. Whenever I edit a value in this table and press enter, this value is saved in the text component in this table.
But when I want to enter 2 words seperated with a TAB between them, then the editor loses focus and moves on to the next cell to edit(like pressing tab in a browser form). I don't want this to happen and let my users enter tabs between words without the focus getting lost. Anyone have an idea how to create this?
I allready tried using a keyListener, but it seems the tab event isn't even processed by this listener
Upvotes: 0
Views: 1369
Reputation: 4693
You could add a TraverseListener
to your textField.
text.addTraverseListener(new TraverseListener () {
public void keyTraversed(TraverseEvent e) {
switch (e.detail) {
case SWT.TRAVERSE_TAB_NEXT:
case SWT.TRAVERSE_TAB_PREVIOUS: {
e.doit = false;
}
}
}
});
Check out this example code snippet.
Upvotes: 5