Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 474954

Summary: Left/Right keys do not Horizontally Scroll a TABLE/TREE control
Product: [RT] RAP Reporter: John Gymer <jgymer>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description John Gymer CLA 2015-08-14 04:40:56 EDT
A RAP Table/Tree does not scroll horizontally with the left/right keys. Snippet below...

/* DEMONSTRATES TABLE HScroll with keyboard issue */
package bug.snippet;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;

public class Bugsy {
	private Display display;
	private Shell shell;
	private static Table tab;
	private static TableColumn col;
	
	public void begin() {
		System.out.println("BugSnippy Starting...");
		
		// create the Shell
		display = new Display();
		shell = new Shell(display, SWT.TITLE|SWT.CLOSE|SWT.RESIZE);
		shell.setText("Shell");
		shell.setFullScreen(true);
		shell.setBackground(new Color(null, new RGB(255,192,255)));
		FormLayout layout = new FormLayout();
		shell.setLayout(layout);

		//create the table
		tab = new Table(shell, SWT.H_SCROLL|SWT.FULL_SELECTION);

		col = new TableColumn(tab, SWT.NONE);
		//col.setResizable(true);
		col.setWidth(700);
		col.setText("My Column");

		col = new TableColumn(tab, SWT.NONE);
		//col.setResizable(true);
		col.setWidth(500);
		col.setText("My 2nd Column");

		//add some data to the table
		String[] tableData = new String[2]; //2 columns
		
		for (int i = 0; i < 100; i++) {
			tableData[0] = "My Value " + i;
			tableData[1] = "Wonderful " + i*10;
			TableItem tableItem = new TableItem(tab, SWT.None, 0);
			tableItem.setText(tableData);
		}
		
		//set table's position
		FormData fd = new FormData();
		fd.left = new FormAttachment(0, 5);
		fd.top = new FormAttachment(0, 5);
		fd.right = new FormAttachment(100,-5);
		fd.bottom = new FormAttachment(100,-130);
		tab.setLayoutData(fd);

		shell.open();

		System.out.println("BugSnippy Done!");
	}
}
Comment 1 Ivan Furnadjiev CLA 2015-08-17 04:21:25 EDT
Just checked in SWT Windows. The Tree doesn't scroll horizontally by using left/right keys. Only Table.
Comment 2 John Gymer CLA 2015-08-17 04:30:17 EDT
A chance to be better than SWT then?!
Comment 3 Ivan Furnadjiev CLA 2015-08-17 04:39:48 EDT
It's kind of in conflict with using the keys for expand/collapse/change selection of items.
Comment 4 John Gymer CLA 2015-08-17 04:56:37 EDT
Ah right, fair enough.
I think it supports Ctrl+Left/Right though for scroll?
Comment 5 Ivan Furnadjiev CLA 2015-08-18 06:26:22 EDT
Fixed in master with change https://git.eclipse.org/r/#/c/53863/
Comment 6 John Gymer CLA 2015-08-25 08:43:54 EDT
Ivan/Tim - not sure if you got my note, but there is a problem with the Tree HScroll with keyboard... if you hold Ctrl+LEFT/RIGHT it not only does an HScroll (correctly), but it also does an expand/contract (the same as when Ctrl is NOT held).
Comment 7 Ivan Furnadjiev CLA 2015-08-25 10:32:15 EDT
(In reply to John Gymer from comment #6)
> Ivan/Tim - not sure if you got my note, but there is a problem with the Tree
> HScroll with keyboard... if you hold Ctrl+LEFT/RIGHT it not only does an
> HScroll (correctly), but it also does an expand/contract (the same as when
> Ctrl is NOT held).

John, a change is pending in Gerrit. As I'm on vacation this week, probably will be merge next week.