Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » how to get a resizable table viewer in a scrolledForm
how to get a resizable table viewer in a scrolledForm [message #276733] Sat, 27 November 2004 09:08
Eclipse UserFriend
Originally posted by: tom_edwards.gmx.net

I'm using this recently added forms concept. So what I have is a
scrolledForm and inside this form a have two section. Now one section
contains a jface table viewer. What I would like to do is to set the
initial height of the table viewer so that the user doesn't have to scroll
the form already in the beginning. I tried to use GridData and set
gridData.heightHint = 100. The height in the beginning is ok but the
problem is that the table viewer does not resize while resizing the
scrollable form. Another problem that I have is that the table viewer
always has three columns (but I added only two?)
If anyone can help me with these problems, thank you very much.

I wrote the following code (the fact that the section is part of a
scrolledForm is not shown):

section.setText("Members");
//create client area for the section
Composite client = toolkit.createComposite(section);
client.setLayout(new GridLayout());
//add table viewer to client area
TableViewer viewer = new TableViewer(
client, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
Table table = viewer.getTable();
GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
gridData.heightHint = 25 * table.getItemHeight();
table.setLayoutData(gridData);
//add two columns
TableColumn objColumn = new TableColumn(table, SWT.LEFT);
objColumn.setWidth(150);
TableColumn attrColumn = new TableColumn(table, SWT.LEFT);
attrColumn.setWidth(150);
table.setHeaderVisible(true);
//set viewer data
viewer.setContentProvider(new TableContentProvider());
viewer.setInput(this.dbObj);
viewer.setLabelProvider(new TableLabelProvider());
viewer.refresh();
//set client area as client for the secton
section.setClient(client);
Previous Topic:I've deployed new version of plugin but old version is cached somewhere?
Next Topic:Cannot select Swing Application after Debug / Breakpoint / Reume
Goto Forum:
  


Current Time: Mon Jul 14 08:05:54 EDT 2025

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

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

Back to the top