Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » [SOLVED] TableComboViewer Scrollbars?
icon3.gif  [SOLVED] TableComboViewer Scrollbars? [message #1229400] Thu, 09 January 2014 11:15 Go to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 355
Registered: July 2009
Senior Member
Hello!

i am trying to use a TableComboViewer in one of my Applications.
i need to limit the visible items to 10 (because have thousands of entries in it and it simply shows me all on screen, which lets the dropdown pop upside...)

this is the way i create the TableComboViewer:
TableComboViewer tcv = new TableComboViewer(this, SWT.BORDER);
tcv.setContentProvider(new ArrayContentProvider());
tcv.setLabelProvider(LookupLabelProvider.getInstance()); // this is a custom label provider


first idea was to use the setItemCount function of the tablecomboviewer
tcv.setItemCount(10);

but this limits the entries to 10 rather than limiting the visible item count to 10 and adding a scrollbar...

next idea was to gain access to the TableCombo itself after it was created.

tcv.getTableCombo().setVisibleItemCount(10);

but this has no effect.
i tried adding this line after setting the visible item count (thought probably i need a refresh function?
tcv.getTableCombo().setShowTableLines(true);

but it draws the table lines fine, and still shows me ALL entries instead of 10...

EDIT: i noticed that if i enter the setVisibleItemCount before i set the ContentProvider and LabelProvider, i at least get the scrollbars (still too many items are shown!)

any ideas about this? is this a bug or am i doing something wrong?
thanks in advance!

[Updated on: Thu, 09 January 2014 12:20]

Report message to a moderator

Re: TableComboViewer Scrollbars? [message #1229409 is a reply to message #1229400] Thu, 09 January 2014 11:36 Go to previous messageGo to next message
Wim Jongman is currently offline Wim Jongman
Messages: 280
Registered: July 2009
Senior Member

Did you look at the snippets? When I run them I see a scrollbar.

http://www.eclipse.org/nebula/snippets.php#TableCombo

Here is the missing model class.

// copyright 2014 Remain BV http://remainsoftware.com
public class Model {

	private final int id;
	private final String description;

	public Model(int id, String description) {
		this.id = id;
		// TODO Auto-generated constructor stub
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public int getId() {
		return id;
	}
}



Re: TableComboViewer Scrollbars? [message #1229411 is a reply to message #1229409] Thu, 09 January 2014 11:45 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 355
Registered: July 2009
Senior Member
yes i did look at those samples, and if i look at TableComboViewer Snippet 1, at the two columns with colors, fonts part i see in code:
////////////////////////////////////////////////////////////////////////
		// Sample #4
		////////////////////////////////////////////////////////////////////////
		// create label
		label = new Label(group, SWT.NONE);
		label.setText("Two Columns (With Colors && Fonts):");
		
		// create TableCombo
		tcv = new TableComboViewer(group, SWT.READ_ONLY | SWT.BORDER);
		tcv.getTableCombo().setLayoutData(new GridData(125, SWT.DEFAULT));
		tcv.getTableCombo().setVisibleItemCount(10);
		...


what i see on screen is shown in my attachment (twenty entries - yes i edited the label)
index.php/fa/17190/0/

[Updated on: Thu, 09 January 2014 11:45]

Report message to a moderator

Re: TableComboViewer Scrollbars? [message #1229425 is a reply to message #1229411] Thu, 09 January 2014 12:19 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 355
Registered: July 2009
Senior Member
RESOLVED!
i downloaded a build from 2014 and its fixed. (mine was 2011 version 1.0.0)
Re: [SOLVED] TableComboViewer Scrollbars? [message #1229464 is a reply to message #1229400] Thu, 09 January 2014 13:53 Go to previous message
Marty Jones is currently offline Marty Jones
Messages: 54
Registered: July 2009
Member
Wim,

Thanks for checking into this. It has been awhile since I looked at the code and I had to pull it down to test myself. Smile

All seems to work as expected for me.

Marty
Previous Topic:change the background color of column headers in the Grid widget
Next Topic:[SOLVED] Expanded tree toggles in Grid
Goto Forum:
  


Current Time: Sat Oct 25 17:36:27 GMT 2014

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

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