Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » first table column no alignment
first table column no alignment [message #457161] Mon, 20 June 2005 08:55 Go to next message
Eclipse User
Originally posted by: elbucho.gmx.de

Hello,

there seems to be a strange problem.

The following code sets center alignment to all columns except(!) the first
one. I can't even imagine why this happens.
Aligning it to the right doesn't work either. The first column is always
left aligned. Can you change this behaviour ?

Thanks
Roland

---------
Display display = new Display();
Shell shell = new Shell(display);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
shell.setLayout(layout);

Table table = new Table(shell, SWT.SINGLE | SWT.BORDER);
table.setLinesVisible(true);
table.setHeaderVisible(true);
TableColumn[] columns = new TableColumn[10];
for (int i = 0; i < 10; i++)
{
columns[i] = new TableColumn(table, SWT.CENTER);
columns[i].setText("I"+i);
columns[i].setWidth(50);
columns[i].setResizable(true);
}

shell.open();
while ( ! shell.isDisposed())
{
if ( ! display.readAndDispatch())
display.sleep();
}
display.dispose();
}
-------------
Re: first table column no alignment [message #457167 is a reply to message #457161] Mon, 20 June 2005 09:51 Go to previous messageGo to next message
Yves Harms is currently offline Yves Harms
Messages: 80
Registered: July 2009
Member
You can't. This is a limitation that swt inherited from Windows.
You can however use a workaround. Just use a "hidden" first column with
setWidth(0), setResizable(false).

Yves

Roland Jürgens wrote:
> Hello,
>
> there seems to be a strange problem.
>
> The following code sets center alignment to all columns except(!) the first
> one. I can't even imagine why this happens.
> Aligning it to the right doesn't work either. The first column is always
> left aligned. Can you change this behaviour ?
>
> Thanks
> Roland
>
> ---------
> Display display = new Display();
> Shell shell = new Shell(display);
> GridLayout layout = new GridLayout();
> layout.numColumns = 1;
> shell.setLayout(layout);
>
> Table table = new Table(shell, SWT.SINGLE | SWT.BORDER);
> table.setLinesVisible(true);
> table.setHeaderVisible(true);
> TableColumn[] columns = new TableColumn[10];
> for (int i = 0; i < 10; i++)
> {
> columns[i] = new TableColumn(table, SWT.CENTER);
> columns[i].setText("I"+i);
> columns[i].setWidth(50);
> columns[i].setResizable(true);
> }
>
> shell.open();
> while ( ! shell.isDisposed())
> {
> if ( ! display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }
> -------------
>
>
Re: first table column no alignment [message #457168 is a reply to message #457161] Mon, 20 June 2005 09:54 Go to previous message
Grant Gayed is currently offline Grant Gayed
Messages: 2141
Registered: July 2009
Senior Member
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=39568

"Roland J
Previous Topic:Can't use MessageDialog(JFace) in SWT application
Next Topic:Resize a Dialog Does not work??
Goto Forum:
  


Current Time: Tue Oct 08 07:57:51 EDT 2013

Powered by FUDForum. Page generated in 0.01942 seconds