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

Bug 296085

Summary: [Widgets] Virtual Table 1st column missing when pack() in setData
Product: [Eclipse Project] Platform Reporter: Praveen <pinnamur>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ericwill, gheorghe, pinnamur, xixiyan
Version: 4.0Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch v01 none

Description Praveen CLA 2009-11-25 02:46:18 EST
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009090216 Ubuntu/9.04 (jaunty) Firefox/3.0.14
Build Identifier: I20091026-1800

According to a post in the newsgroup 
http://www.eclipse.org/forums/index.php?t=msg&th=158337&start=0&S=14d3a4e8c62ef6fe578fd1d17c654912
The first column of virtual table is not visible when it is packed in SetData listener code.
The problem is not reproducible on Windows.

Reproducible: Always

Steps to Reproduce:
Here is the snippet for reproducing the problem - 
public class TableTest {
	private boolean isPacked = false;
	Table table = null;
	
  public static void main(String[] args) {
    new TableTest().run();
  }

  public void run() {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    table = new Table(shell, SWT.BORDER | SWT.SINGLE | SWT.VIRTUAL);
    for (int i = 0; i < 5; i++) {
      TableColumn column = new TableColumn(table, SWT.NONE);
      column.setText("Column" + Integer.toString(i));
    }
	table.setHeaderVisible(true);
	table.setLinesVisible(true);
	table.setItemCount(10);
	table.addListener(SWT.SetData, new Listener () {
	      public void handleEvent (Event event) {
	          TableItem item = (TableItem) event.item;
	          int index = table.indexOf(item);
	          for (int j = 0; j < 5; j++) {
	              item.setText(j, "(" + index + "," + j + ")");
	          }
	          if (! isPacked) {
	        	  isPacked = true;
	        	  for (int i =0; i < table.getColumnCount(); i++) {
	        		  System.out.println("Pack column " + i);
	        		  table.getColumn(i).pack();
	        	  }
	          }
	      }
	  }); 
	
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}
Comment 1 Bogdan Gheorghe CLA 2009-11-25 10:16:57 EST
Praveen to provide patch for this...
Comment 2 Praveen CLA 2009-11-26 02:12:29 EST
Created attachment 153149 [details]
Patch v01

Bogdan, please review the patch. Thanks.
Comment 3 Eric Williams CLA 2018-05-15 14:37:17 EDT
Something isn't right here, I can see this bug as well as some other problems. For example the Table is scrolled to half way down, and scrolling the table produces cheese.
Comment 4 Xi Yan CLA 2018-12-04 09:44:29 EST
I cannot reproduce this anymore on GTK3.24 using SWT master as of today. Please reopen this ticket if the issue reoccurs.