Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to remove extra Column from Table widget?
How to remove extra Column from Table widget? [message #436589] Thu, 20 May 2004 03:47 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
strus is currently offline strusFriend
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
>
>
Re: How to remove extra Column from Table widget? [message #436626 is a reply to message #436614] Thu, 20 May 2004 16:01 Go to previous messageGo to next message
Ross Yakulis is currently offline Ross YakulisFriend
Messages: 29
Registered: July 2009
Junior Member
One trick I have used to remove the last column is make the second column
realy long (500 pixels) so it extends past the edge and is clipped and then
turn off horizontal scrolling. Or setting the last column to
be the length of was is left from the lengths of the previous columns.
column1.setWidth(C1_WIDTH);
column2.setWidth(C2_WIDTH);
column3.setWidth( table.getBounds().width - (C1_WIDTH + C2_WIDTH) );

Try using a TableViewer? I have not noticed with TableView I do not see
that problem.


"strus" <strus_fr@yahoo.fr> wrote in message
news:c8hscd$ori$1@eclipse.org...
> 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
Re: How to remove extra Column from Table widget? [message #436644 is a reply to message #436614] Fri, 21 May 2004 13:13 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
See:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet77.html

"strus" <strus_fr@yahoo.fr> wrote in message
news:c8hscd$ori$1@eclipse.org...
> 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
Re: How to remove extra Column from Table widget? [message #436647 is a reply to message #436614] Fri, 21 May 2004 13:16 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
The last column is simply what Windows XP does. Check out the FileExplorer.
(BTW: On some XP themes, it doesn't draw).

"strus" <strus_fr@yahoo.fr> wrote in message
news:c8hscd$ori$1@eclipse.org...
> 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
Previous Topic:Menu/MenuItem + ordering
Next Topic:Shell + Eclipse questions
Goto Forum:
  


Current Time: Fri Mar 29 01:15:47 GMT 2024

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

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

Back to the top