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

Bug 97733

Summary: [GTK] Table.setHeaderVisible and setColumnOrder do not respect setRedraw(false)
Product: [Eclipse Project] Platform Reporter: Grant Gayed <grant_gayed>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, billy.biggs, cocoakevin, ericwill
Version: 4.7Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description Grant Gayed CLA 2005-05-31 16:58:40 EDT
3.1RC1

- run the snippet below (demonstrates the setHeaderVisible case)
- click on the shell and Table.setRedraw(false) is invoked
- click on the shell again and Table.setHeaderVisible(false) is invoked.  This 
hides the header and copies item cheese to where it was.  It seems like this
should do nothing because of the previous setRedraw(false)
- click on the shell again and Table.setRedraw(true) is invoked: now things seem
right again
- to see the Table.setColumnOrder case just uncomment the line in the MouseDown
listener and comment out the setHeaderVisible line above it

public class Main {
	static int counter = 0;
public static void main(String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	shell.setBounds(10, 10, 300, 300);
	final Table table = new Table(shell, SWT.NONE);
	table.setHeaderVisible(true);
	table.setBounds(10, 10, 200, 200);
	TableColumn column = new TableColumn(table, SWT.NONE);
	column.setText("0");
	column.setWidth(75);
	column = new TableColumn(table,SWT.CENTER);
	column.setText("1");
	column.setWidth(120);
	new TableItem(table, SWT.NONE).setText(new String[] {"abc","def"});
	shell.addListener(SWT.MouseDown, new Listener() {
		public void handleEvent(Event event) {
			if (counter == 0) {
				System.out.println("setRedraw(false)");
				table.setRedraw(false);
				counter++;
				return;
			}
			if (counter == 1) {
				System.out.println("setHeaderVisible(true): overwrites item");
				table.setHeaderVisible(false);
				//table.setColumnOrder(new int[] {1,0});
				counter++;
				return;
			}
			if (counter == 2) {
				System.out.println("setRedraw(true), item reappears");
				table.setRedraw(true);
				counter++;
				return;
			}
			System.out.println("nothing left to do");
		}
	});
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}
}
Comment 1 Eric Williams CLA 2016-08-03 16:59:43 EDT
This is reproducible, not sure how important it is but still reproducible. Assigning to Ian.
Comment 2 Ian Pun CLA 2016-08-09 11:45:21 EDT
Hi,

setRedraw() is a hint operation that does not fully support all widgets, which is causing the issue we see here. The note about this can be seen here:

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fwidgets%2FControl.html
Comment 3 Alexander Kurtakov CLA 2017-05-23 03:18:14 EDT
Reset to default assignee and move out of 4.7.
Comment 4 Eric Williams CLA 2019-02-19 09:58:27 EST
Not going to fix this as it isn't feasible in GTK and IMO isn't really a big issue. Control.setRedraw() is a hint anyways.

As for cheese -- I think that fixed elsewhere because I don't see it here.