Community
Participate
Working Groups
Displaying data from a database table containing a large number of fields, I came across a strange bug in the Table widget. After a few thousand pixels width, the header of the table is no longer drawn. The Table content itself *is* drawn like it should. It doesn't seem to be the number of columns displayed that's causing the problem, but rather the width.
I cannot reproduce this (on win2000) with the following snippet; can you provide a snippet, or modify the one below, to show the problem happening? SN does this sound like a windows bug? public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10,10,200,200); Table table = new Table (shell, SWT.VIRTUAL | SWT.H_SCROLL | SWT.V_SCROLL); table.setHeaderVisible(true); table.setLinesVisible(true); table.setBounds(10,10,150,150); String[] contents = new String[100]; for (int i = 0; i < 100; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText("col " + i); column.setWidth(200); contents [i] = "abcdefghijklmnopqrstuvwxyz"; } new TableItem(table, SWT.NONE).setText(contents); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Here is the code, the bugs shows around column 163: ------------- public class TableTest { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10,10,200,200); FormLayout formLayout = new FormLayout (); formLayout.marginWidth = 10; formLayout.marginHeight = 10; shell.setLayout(formLayout); shell.setText("Table Test"); Table table = new Table (shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); table.setHeaderVisible(true); table.setLinesVisible(true); table.setBounds(10,10,150,150); int size = 200; String[] contents = new String[size]; for (int i = 0; i < size; i++) { TableColumn column = new TableColumn(table, SWT.RIGHT); column.setText("col " + i); column.setWidth(200); contents [i] = "abcdefghijklmnopqrstuvwxyz"; column.setResizable(true); column.setAlignment(SWT.RIGHT); } for (int i=0;i<50;i++) { new TableItem(table, SWT.NONE).setText(contents); } FormData fdTable=new FormData(); fdTable.left = new FormAttachment(0, 0); fdTable.right = new FormAttachment(100, 0); fdTable.top = new FormAttachment(0, 0); fdTable.bottom = new FormAttachment(100, 0); table.setLayoutData(fdTable); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } } ------ Cheers, Matt
Wow. Looks like a bug in Windows. Since we don't draw the column headers or the contents of the table, there's not much we can do about it. Sorry CANTFIX.
*** Bug 302248 has been marked as a duplicate of this bug. ***
Created attachment 210948 [details] Simple C app Here is a simple C application that reproduces the problem.