Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Hide column in TableCombo.
Hide column in TableCombo. [message #629137] Mon, 27 September 2010 10:41 Go to next message
Neha is currently offline NehaFriend
Messages: 52
Registered: July 2009
Member
Hi All,
In my application I need to hide a column of tablecombo and use the same
hidden column index as display column index. Is there a way to do so ?
Please do let me know.
I tried the following way

TableComboViewer tableComboViewer = new TableComboViewer(composite,
SWT.READ_ONLY | SWT.BORDER);
TableCombo tableCombo = tableComboViewer.getTableCombo();
tableCombo.setShowImageWithinSelection(false);
tableCombo.setLayoutData(new GridData(125, SWT.DEFAULT));
tableCombo.setVisibleItemCount(10);
tableCombo.setShowTableHeader(true);
tableCombo.defineColumns(new String[] { "ID", "Name", "Combo Text" },
new int[] { 60, 100, 0 });
tableCombo.setDisplayColumnIndex(2);//use display index of hidden col
tableComboViewer.setContentProvider(new ArrayContentProvider());
tableComboViewer.setLabelProvider(new LabelProvider());
int iCounter;
for (iCounter = 0; iCounter < 3; iCounter++) {
ColumnSelectionListenerForTableCombo colListener = new
ColumnSelectionListenerForTableCombo(
iCounter, tableComboViewer, componentType);
tableCombo.getTable().getColumn(iCounter).addSelectionListen er(
colListener);
}
tableCombo.getTable().getColumn(2).setWidth(0);//set width of column to be
hidden to 0
tableCombo.getTable().getColumn(2).setResizable(false)
tableCombo.redraw();
But it doesnt seem to be working.
Re: Hide column in TableCombo. [message #629162 is a reply to message #629137] Mon, 27 September 2010 11:56 Go to previous messageGo to next message
Marty Jones is currently offline Marty JonesFriend
Messages: 54
Registered: July 2009
Member
I modified the TableComboSnippet1 class on the sample #5 as follows:

// tell the TableCombo that I want 3 columns autosized with the following column headers.
//tc.defineColumns(new String[] { "Id", "Description", "Computed"});
tc.defineColumns(new String[] { "Id", "Description", "Computed" },
			new int[] { 60, 100, 0 });


This made the third column hidden and also when a item was selected in the combo, the third column's text displayed in the selection box. So everything seems to be working fine for me.

A few questions:

1. What OS are you running?

2. What version of Eclipse are you running?
Re: Hide column in TableCombo. [message #629471 is a reply to message #629162] Tue, 28 September 2010 12:16 Go to previous message
Neha is currently offline NehaFriend
Messages: 52
Registered: July 2009
Member
Hi Marty,
Thanks for your reply.
Ans to your questions
1. I m using windows xp. version 5.1,service pack 3
2.Eclipse:
Version: 3.4.1

Build id: M20080911-1700



"Marty Jones" <martybjones@gmail.com> wrote in message
news:i7q0kh$ics$1@news.eclipse.org...
>I modified the TableComboSnippet1 class on the sample #5 as follows:
>
> // tell the TableCombo that I want 3 columns autosized with the following
> column headers.
> //tc.defineColumns(new String[] { "Id", "Description", "Computed"});
> tc.defineColumns(new String[] { "Id", "Description", "Computed" },
> new int[] { 60, 100, 0 });
>
>
> This made the third column hidden and also when a item was selected in the
> combo, the third column's text displayed in the selection box. So
> everything seems to be working fine for me.
>
> A few questions:
>
> 1. What OS are you running?
>
> 2. What version of Eclipse are you running?
Previous Topic:What is the recommended date widget with EclipseRCP?
Next Topic:Help with PShelf size and rendering
Goto Forum:
  


Current Time: Fri Mar 29 04:50:44 GMT 2024

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

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

Back to the top