Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Is there a practical limit to the number of columns in a Table?
Is there a practical limit to the number of columns in a Table? [message #501257] Tue, 01 December 2009 11:47 Go to next message
drew frantz is currently offline drew frantz
Messages: 340
Registered: July 2009
Senior Member
No Message Body
Re: Is there a practical limit to the number of columns in a Table? [message #501287 is a reply to message #501257] Tue, 01 December 2009 13:28 Go to previous messageGo to next message
drew frantz is currently offline drew frantz
Messages: 340
Registered: July 2009
Senior Member
It seems related to the count of characters comprising the sum of all column
headers, at a certain point for a table the column hearder text will get
truncated. Somehwere around 2470 characters. I tried this in 2 different
applications, one is the application I am working and another is just a
SWTSnippet like example both fail in aproximately the same count of
characters.

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.VIRTUAL | SWT.MULTI | SWT.BORDER |
SWT.FULL_SELECTION);
table.setLinesVisible (true);
table.setHeaderVisible (true);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.heightHint = 200;
table.setLayoutData(data);
int item=0;
int charCnt = 0;
// truncates on win32 at around 2470 characters
for(int x=0;x<900;x++)
{
TableColumn column = new TableColumn (table, SWT.NONE);
StringBuffer b = new StringBuffer();
b.append(item++);
column.setText (b.toString());
charCnt+=b.toString().length();
column.setToolTipText(Integer.toString(charCnt));
}
int tCnt = table.getColumnCount();
for (int i=0; i<tCnt; i++)
{
table.getColumn (i).pack ();
}
shell.pack ();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();


}


"drew" <drew@acm.org> wrote in message
news:hf3h5j$bsd$1@build.eclipse.org...
>
>
Re: Is there a practical limit to the number of columns in a Table? [message #501312 is a reply to message #501287] Tue, 01 December 2009 15:12 Go to previous message
drew frantz is currently offline drew frantz
Messages: 340
Registered: July 2009
Senior Member
Found the problem see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=251379

"drew" <drew@acm.org> wrote in message
news:hf3n32$mpe$1@build.eclipse.org...
> It seems related to the count of characters comprising the sum of all
> column headers, at a certain point for a table the column hearder text
> will get truncated. Somehwere around 2470 characters. I tried this in 2
> different applications, one is the application I am working and another is
> just a SWTSnippet like example both fail in aproximately the same count of
> characters.
>
> 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.VIRTUAL | SWT.MULTI | SWT.BORDER |
> SWT.FULL_SELECTION);
> table.setLinesVisible (true);
> table.setHeaderVisible (true);
> GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
> data.heightHint = 200;
> table.setLayoutData(data);
> int item=0;
> int charCnt = 0;
> // truncates on win32 at around 2470 characters
> for(int x=0;x<900;x++)
> {
> TableColumn column = new TableColumn (table, SWT.NONE);
> StringBuffer b = new StringBuffer();
> b.append(item++);
> column.setText (b.toString());
> charCnt+=b.toString().length();
> column.setToolTipText(Integer.toString(charCnt));
> }
> int tCnt = table.getColumnCount();
> for (int i=0; i<tCnt; i++)
> {
> table.getColumn (i).pack ();
> }
> shell.pack ();
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
>
>
> }
>
>
> "drew" <drew@acm.org> wrote in message
> news:hf3h5j$bsd$1@build.eclipse.org...
>>
>>
>
>
Previous Topic:PGroup leak problem
Next Topic:freezing swt gui
Goto Forum:
  


Current Time: Tue Jul 29 23:04:37 EDT 2014

Powered by FUDForum. Page generated in 0.08168 seconds