Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Using TAB to jump from column to column
Using TAB to jump from column to column [message #446408] Wed, 24 November 2004 17:35
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6570
Registered: July 2009
Senior Member
I've just started to implement a key-listener who has the following purpose:
When the TAB-key is pressed I want to go to the next column in the
TableViewer and start editing it. I'm already catching the TAB event but
I somehow could open the editor in the next column what am I doing wrong
here. It must have missed something very basically or the whole approach
I'm taking is completely wrong?

See also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=75114

Although in my understanding when using SWT/JFace as an input-gui e.g.
to a database this feature is mandatory its not part of it until now.

---------------------------8<---------------------------
public class TraversalTest implements TraverseListener {
private int columnIdx = 0;
private TableViewer viewer;

public TraversalTest( TableViewer viewer, int columnIdx ) {
this.columnIdx = columnIdx;
this.viewer = viewer;
}

/* (non-Javadoc)
* @see
org.eclipse.swt.events.TraverseListener#keyTraversed(org.ecl ipse.swt.events.TraverseEvent)
*/
public void keyTraversed(TraverseEvent e) {
// TODO Auto-generated method stub
if( e.detail == SWT.TRAVERSE_TAB_PREVIOUS || e.detail ==
SWT.TRAVERSE_TAB_NEXT ) {
if( viewer != null ) {
CellEditor[] editors = viewer.getCellEditors();
e.doit = false;
if( columnIdx > 0 && e.detail ==
SWT.TRAVERSE_TAB_PREVIOUS ) {
// editors[columnIdx].deactivate();
// editors[columnIdx-1].activate();
// editors[columnIdx-1].setFocus();
// editors[columnIdx-1].getControl().forceFocus();
} else if( e.detail == SWT.TRAVERSE_TAB_NEXT &&
columnIdx+1
< editors.length ) {
// editors[columnIdx].deactivate();
// editors[columnIdx+1].activate();
// editors[columnIdx-1].setFocus();
// editors[columnIdx+1].getControl().forceFocus();
} else {
System.out.println("We reached start or end of
row");
}
} else {
System.out.println("I have no viewer");
}
} else {
System.out.println("No need to cancle its not a
tab-event");
}
}
}
---------------------------8<---------------------------
Previous Topic:How to add Table column header mouse listener?
Next Topic:Is it possible to do drag-and-drop operation between swt and swing component?
Goto Forum:
  


Current Time: Sun Oct 25 06:14:15 GMT 2020

Powered by FUDForum. Page generated in 0.01482 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top