How to remove extra Column from Table widget? [message #436589] |
Thu, 20 May 2004 03:47 |
Eclipse User |
|
|
|
Originally posted by: albert_tan.operamail.com
Hi,
I am trying to use a Table widget in my wizard page. The thing is that
even though I am adding only TWO COLUMNS to the table but
when I launch my wizard it shows a table with THREE COLUMNS, don't
know how to remove that, below is my code that I use in my wizard to
create the Table :
public void createControl(Composite parent) {
wizard = (MyWizard) getWizard();
Composite composite = new Composite(parent, SWT.NULL);
// create the desired layout for this wizard page
GridLayout gl = new GridLayout();
int ncol = 1;
gl.numColumns = ncol;
composite.setLayout(gl);
GridData gd = new GridData(GridData.BEGINNING);
gd.horizontalSpan = ncol;
Label lbl = new Label(composite, SWT.NONE);
lbl.setText("Display Data");
lbl.setLayoutData(gd);
Table tblData=
new Table(
composite,
SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.BORDER);
tblData.setHeaderVisible(true);
tblData.setLinesVisible(true);
String[] titles = {" Name", "Description"};
for (int i=0; i<titles.length; i++) {
TableColumn column = new TableColumn (tblData, SWT.NULL);
column.setText (titles [i]);
}
for (int i=0; i<titles.length; i++) {
tblData.getColumn (i).pack ();
}
tblData.setSize (tblParams.computeSize (SWT.DEFAULT, 200));
gd = new GridData(GridData.FILL_BOTH);
gd.horizontalSpan = 1;
gd.heightHint = 150;
tblData.setLayoutData(gd);
setControl(composite);
}
thnaks
Albert Tan
|
|
|
Re: How to remove extra Column from Table widget? [message #436614 is a reply to message #436589] |
Thu, 20 May 2004 09:13 |
strus Messages: 113 Registered: July 2009 |
Senior Member |
|
|
Well, I have the same problem and it seems to have no solution yet.
Note that the last column is no a real column, but more a painting
side-effect depending on the layout you use.
Albert a écrit :
> Hi,
>
> I am trying to use a Table widget in my wizard page. The thing is that
> even though I am adding only TWO COLUMNS to the table but
> when I launch my wizard it shows a table with THREE COLUMNS, don't
> know how to remove that, below is my code that I use in my wizard to
> create the Table :
>
>
>
> public void createControl(Composite parent) {
>
> wizard = (MyWizard) getWizard();
>
> Composite composite = new Composite(parent, SWT.NULL);
>
> // create the desired layout for this wizard page
> GridLayout gl = new GridLayout();
> int ncol = 1;
> gl.numColumns = ncol;
> composite.setLayout(gl);
>
> GridData gd = new GridData(GridData.BEGINNING);
> gd.horizontalSpan = ncol;
> Label lbl = new Label(composite, SWT.NONE);
> lbl.setText("Display Data");
> lbl.setLayoutData(gd);
>
> Table tblData=
> new Table(
> composite,
> SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.BORDER);
>
> tblData.setHeaderVisible(true);
> tblData.setLinesVisible(true);
>
> String[] titles = {" Name", "Description"};
>
> for (int i=0; i<titles.length; i++) {
> TableColumn column = new TableColumn (tblData, SWT.NULL);
> column.setText (titles [i]);
> }
> for (int i=0; i<titles.length; i++) {
> tblData.getColumn (i).pack ();
> }
> tblData.setSize (tblParams.computeSize (SWT.DEFAULT, 200));
>
> gd = new GridData(GridData.FILL_BOTH);
> gd.horizontalSpan = 1;
> gd.heightHint = 150;
> tblData.setLayoutData(gd);
>
> setControl(composite);
>
> }
>
> thnaks
> Albert Tan
>
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04633 seconds