[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Truncated SWT table column headers.

Hi, Paul.

You seem to have run across a Windows limitation.
Can you get away with reducing your column header string to include only the 
essentials?
i.e. The following snippet shows 444 columns, and if I set the column width 
to 50 instead of packing, then it shows 654.
What is the maximum number of columns that your application needs?

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;

public class TableManyHeadersTest {

 static final int COLUMN_COUNT = 1000;
 static final int ROW_COUNT = 5;

 public static void main(String[] args) {
  Display display = new Display();
  Shell shell = new Shell(display);
  shell.setLayout(new GridLayout());

  Table table = new Table(shell, SWT.FULL_SELECTION);
  table.setLayoutData(new GridData(GridData.FILL_BOTH));
  table.setHeaderVisible(true);
  for (int col = 0; col < COLUMN_COUNT; col++) {
   TableColumn column = new TableColumn(table, SWT.NONE);
   column.setText("V" + col + "::String");
//   column.setWidth(50);
   column.pack();
  }
  for (int row = 0; row < ROW_COUNT; row++) {
   TableItem item = new TableItem(table, SWT.NONE);
   for (int col = 0; col < COLUMN_COUNT; col++) {
    item.setText(col, "R" + row + "C" + col);
   }
  }

  shell.pack();
  shell.open();
  while (!shell.isDisposed()) {
   if (!display.readAndDispatch()) display.sleep();
  }
 }
}

The only other suggestion I have is to consider refactoring your UI into 
maybe a tabfolder of 100-column tables or something like that.

Hope this helps,
Carolyn

"Paul Slauenwhite" <paules@xxxxxxxxxx> wrote in message 
news:gd4oa0$e0j$1@xxxxxxxxxxxxxxxxxxxx
> SWT Experts,
>
> We have found a problem with a SWT table in our project (TPTP) that is 
> proving to be difficult to debug.  When the table has a large number of 
> columns (e.g. 329 or more), the 329th column header is truncated (see 
> attached screen capture - note, the first column is 'Variable0::String') 
> and the remaining column headers (330+) are missing.  It appears to be a 
> limit on the width of the column header row since the columns that do 
> appear can be resized (e.g. reducing their size make the remaining column 
> headers (330+) appear) and reducing the width of each table column will 
> display more column headers.
>
> Has anyone seen this type of behaviour before?  If so, what was the 
> solution?  If not, are there any tips on debugging such a problem?
>
> Note, we have proven that this is not a SWT defect and is an issue with 
> our code.
>
> Thanks in advance,
> Paul
>
>