Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » CheckboxTableViewer with more than 2 columns?
CheckboxTableViewer with more than 2 columns? [message #1103227] Fri, 06 September 2013 14:08 Go to next message
Alan DW is currently offline Alan DW
Messages: 105
Registered: March 2012
Senior Member
Hello everyone,

as we all know, the default CheckboxTableViewer is a handy widget and uses two columns: one for the checkboxes and one for displaying the elements. What I would like to have is an additional text column, such that the column layout is like this:

[check][text][text]

The last text column should just display some additional information about the item in question. I tried to solve it like this:

		Table table = new Table(composite_6, SWT.CHECK);
		table.setLinesVisible(false);
		table.setHeaderVisible(false);
		TableColumn tc0 = new TableColumn(table, SWT.NONE);
		TableColumn tc1 = new TableColumn(table, SWT.NONE);

		this.checkboxTableViewer = new CheckboxTableViewer(table);
		this.checkboxTableViewer.setContentProvider(new MyTableContentProvider());
		this.checkboxTableViewer.setLabelProvider(new MyTableLabelProvider());


... but if I do that, I don't see any content anymore in the table, regardless of the input. Is it possible to do it this way? If so, how would the "getElements()" return array of the TableContentProvider have to be structured? After all, it has to provide content for more than 1 column now...


I'm still new to SWT, so sorry if this is a dumb question or has been asked before, I'd be glad for any help!


Thanks,


Alan
Re: CheckboxTableViewer with more than 2 columns? [message #1108846 is a reply to message #1103227] Sat, 14 September 2013 13:14 Go to previous messageGo to next message
Alan DW is currently offline Alan DW
Messages: 105
Registered: March 2012
Senior Member
No answer means that it is impossible? The problem is still open...
Re: CheckboxTableViewer with more than 2 columns? [message #1109675 is a reply to message #1108846] Sun, 15 September 2013 20:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5422
Registered: July 2009
Senior Member
You need to set a label provider / column!

Tom

On 14.09.13 15:14, Alan DW wrote:
> No answer means that it is impossible? The problem is still open...
Re: CheckboxTableViewer with more than 2 columns? [message #1115643 is a reply to message #1103227] Tue, 24 September 2013 11:29 Go to previous messageGo to next message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
You can find some tableviewer examples here -- http://wiki.eclipse.org/JFaceSnippets

Lakshmi P Shanmugam
Re: CheckboxTableViewer with more than 2 columns? [message #1115658 is a reply to message #1115643] Tue, 24 September 2013 11:51 Go to previous message
Alan DW is currently offline Alan DW
Messages: 105
Registered: March 2012
Senior Member
Hello,

thanks you two, I think I can get it done now with the hints and resources you provided.

Thanks a lot!


Alan
Previous Topic:How can I associate custom widgets with TreeItems in SWT?
Next Topic:SWT "/dev/null" driver?
Goto Forum:
  


Current Time: Sat Oct 25 16:58:43 GMT 2014

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

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