Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » TableViewer's Horizontal Scrollbar
TableViewer's Horizontal Scrollbar [message #737066] Fri, 14 October 2011 16:09 Go to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi all,

I have a TableViewer that contains only 1 column and I want it to have the following behavior:

1. When the content width is less than the TableViewer's width, the column should occupy all the remaining space.
2. When the content width exceeds the TableViewer's width, a horizontal scrollbar should be drawn to enable user to see the entire content.

It seems that I can not have the above behavior at once.

For 1st behavior I've added the following:
...
Composite tableContainer = toolkit.createComposite(parent);
tableContainer.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
tableContainer.setLayout(new TableColumnLayout());

TableViewer tableViewer = ...

TableViewerColumn tableViewerColumn = new TableViewerColumn(tableViewer, SWT.NONE);
((TableColumnLayout)tableContainer.getLayout()).setColumnData(tableViewerColumn.getColumn(), new ColumnWeightData(100, ColumnWeightData.MINIMUM_WIDTH, false));
...


Which works fine as shown by 1st screenshot.

But I'm still missing the 2nd behavior (2nd screenshot), so I add the following after TableViewer#setInput:

...
tableViewer.getTable().getColumns()[0].pack();
...


This works fine for very long content (3rd screenshot), but not for short content (4th screenshot).

I might have done things improperly here so any help would be appreciated.

Thanks & Regards,

Setya
Re: TableViewer's Horizontal Scrollbar [message #749882 is a reply to message #737066] Tue, 25 October 2011 13:49 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Well,

Anyone ? any idea ?

Regards,

Setya
Re: TableViewer's Horizontal Scrollbar [message #749886 is a reply to message #737066] Tue, 25 October 2011 13:49 Go to previous messageGo to next message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Well,

Anyone ? any idea ?

Regards,

Setya
Re: TableViewer's Horizontal Scrollbar [message #752604 is a reply to message #749882] Wed, 26 October 2011 12:59 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Setya,
could you attach a complete self running snippet to try it? Did you try your code in RCP (SWT)? Do you have a working solution with RCP (SWT) that does not work in RAP?
Best,
Ivan
Re: TableViewer's Horizontal Scrollbar [message #753912 is a reply to message #752604] Sun, 30 October 2011 14:47 Go to previous message
Setya Nugdjaja is currently offline Setya NugdjajaFriend
Messages: 567
Registered: July 2009
Senior Member
Hi Ivan,

I've created Bug# 362432 regarding this.

I was wrong it's about TableViewer's background color, not its
horizontal scrollbar.

Thanks & Regards,

Setya
Previous Topic:Add popup menu to a JFace View
Next Topic:Drag an object from other Windows app to RAP component
Goto Forum:
  


Current Time: Thu Apr 25 21:17:36 GMT 2024

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

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

Back to the top