Project: SWT
Bug 128273 TableCursor not working properly on Linux GTK
Reported: 2006-02-16 14:40:06 | Status: verified fixed

The table cursor is not moving correctly when I navigate with the arrow keys. The behavior I get between a virtual table and a non-virtual table is different. But both cases do not quite work as I expect. Non-Virtual Table =================== I use the Up and Down arrow keys to move the cursor. When the cursor is at the end of the page and if I keep pushing the down button, the table will start to scroll. I see that the top row is changing, but the cursor remains at the same cell. If I push the "Up" button, the cursor goes back to where it is supposed to be and jumps to a cell below. I expect the cursor to behave like it is on windows. If I am at the bottom and I keep moving down, the table should scroll. The cursor should move one cell down. Virtual Table ================== For virtual table, if I keep pressing the down key at the end of the page, the cursor first disappears. If I keep pressing the down key, the table is reloaded with the next page of data and the cursor is moved to the top of the screen. Testcase: ============ public class TestTableBug { private static TableColumn column1; private static TableColumn column2; private static TableColumn column3; public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); final Table table = new Table(shell, SWT.BORDER | SWT.MULTI | SWT.VIRTUAL| SWT.V_SCROLL); final TableCursor cursor = new TableCursor(table, SWT.NONE); table.setLayoutData(new GridData(GridData.FILL_BOTH)); column1 = new TableColumn(table, SWT.NONE); column1.setText("A"); column2 = new TableColumn(table, SWT.NONE); column1.setText("B"); column3 = new TableColumn(table, SWT.NONE); column1.setText("C"); for (int i = 0; i < 500; i++) { TableItem item = new TableItem(table, SWT.NONE); item.setText(new String[] { "cell "+i+" 0", "cell "+i+" 1", "cell "+i+" 2"}); } // These have no effects on Linux GTK? column1.pack(); column2.pack(); column3.pack(); Button action = new Button(shell, SWT.PUSH); action.setText("Pack Columns"); action.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { // These have no effects on Linux GTK? column1.pack(); column2.pack(); column3.pack(); } public void widgetDefaultSelected(SelectionEvent e) { }}); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java