Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table.getColumn(0).pack() is 2 too low
Table.getColumn(0).pack() is 2 too low [message #559092] Wed, 15 September 2010 15:17 Go to next message
H. Niemann is currently offline H. NiemannFriend
Messages: 5
Registered: September 2010
Junior Member
Hello!

If I create a table and pack() it's columns,
the longest text in the first column does not fit and
is shortend and ... dots are added.

If I increase the width of the column after pack()ing by 2,
it works. Only column 0 is affected, as far as I can tell.

I can provide a screen shot by private mail.

Is this a known problem? How can I fix that, other than
increasing the width by hand?

With best regards
H. Niemann

--8<---------------------------
public void axisTable(Table table, int i)
{
int dim = this.getDimension();
table.setHeaderVisible(false);
table.setLinesVisible(true);
TableColumn col = new TableColumn(table, SWT.NULL); // Labels
col = new TableColumn(table, SWT.NULL); // X axis
TableItem line;
line = new TableItem(table, SWT.NULL);
line.setText(0, "Adding "+String.valueOf(i)+" to");
line.setText(1, "pack() result");

for (int ii = 0; ii < table.getColumnCount(); ii++)
{
table.getColumn(ii).pack();
}
col = table.getColumn(0);
col.setWidth(col.getWidth()+i);
table.pack();
}
Re: Table.getColumn(0).pack() is 2 too low [message #559593 is a reply to message #559092] Fri, 17 September 2010 10:25 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,

This works fine for me. Which platform are you using?
This is the snippet that works for me on windows. Can you try if it works fine for you? Can you modify this to show us the failing case?

public class Table_pack {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(1, false));
Table table = new Table(shell, SWT.SINGLE | SWT.FULL_SELECTION);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
table.setLinesVisible(true);
table.setHeaderVisible(false);

new TableColumn(table, SWT.NONE);
new TableColumn(table, SWT.NONE);
TableItem line;
line = new TableItem(table, SWT.NULL);
line.setText(0, "Adding to");
line.setText(1, "pack() result");
for (int ii = 0; ii < table.getColumnCount(); ii++) {
table.getColumn(ii).pack();
}
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}


Lakshmi P Shanmugam
Re: Table.getColumn(0).pack() is 2 too low [message #559881 is a reply to message #559593] Mon, 20 September 2010 08:29 Go to previous messageGo to next message
H. Niemann is currently offline H. NiemannFriend
Messages: 5
Registered: September 2010
Junior Member
Thank you Lakshmi for your "works for me" test application, which gave me the hint I needed.


Table table = new Table(shell, SWT.NULL);

gives

| Adding... | pack() result |


Table table = new Table(shell, SWT.FULL_SELECTION );

gives

| Adding to | pack() result |


I had not needed selection at all ..

Is this worth a bug report? If packing depends on the selction mode, it should be fixed or documented.


Hartmut.
Re: Table.getColumn(0).pack() is 2 too low [message #560172 is a reply to message #559881] Tue, 21 September 2010 12:44 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
I too think that packing should not depend on the selection mode. But, I'm unable to reproduce the problem even if I create a Tree with SWT.NONE. Which platform are you using? I tried it out on windows XP, 32-bit.

Lakshmi P Shanmugam
Re: Table.getColumn(0).pack() is 2 too low [message #625407 is a reply to message #560172] Wed, 22 September 2010 08:37 Go to previous message
H. Niemann is currently offline H. NiemannFriend
Messages: 5
Registered: September 2010
Junior Member
Our primary development platform is 3.4.something,
but I checked it with Helios, with the RCP installer downloaded today.
On XP 32bit, as you have.

I filed Bug 325932 . Let's see what happens next.

Maybe you could try the sample application that I appended to the bug report?
Previous Topic:Gtk TYPE_HINT_DIALOG
Next Topic:Find TableColumn by Point
Goto Forum:
  


Current Time: Tue Apr 16 22:44:34 GMT 2024

Powered by FUDForum. Page generated in 0.19359 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top