Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table. Default Displayable Rows
Table. Default Displayable Rows [message #459552] Wed, 10 August 2005 13:50 Go to next message
Dave Smith is currently offline Dave SmithFriend
Messages: 34
Registered: July 2009
Member
I am using a table and by default I load 50 rows.
I would only like 15 of them visible at startup. What is the
easiest way to set the default number of displayable rows?
Re: Table. Default Displayable Rows [message #459563 is a reply to message #459552] Wed, 10 August 2005 22:40 Go to previous messageGo to next message
Chris is currently offline ChrisFriend
Messages: 17
Registered: July 2009
Junior Member
dave smith wrote:

> I am using a table and by default I load 50 rows.
> I would only like 15 of them visible at startup. What is the
> easiest way to set the default number of displayable rows?

I'm not sure of a *nice* way of doing this, but you could use a height
hint:

tableGridData.heightHint = table.getItemHeight() * 15;
Re: Table. Default Displayable Rows [message #459590 is a reply to message #459552] Thu, 11 August 2005 18:29 Go to previous message
Eclipse UserFriend
Originally posted by: sarek.nurfuerspam.de

Hi,

On 10.08.2005 15:50, dave smith wrote:

> I am using a table and by default I load 50 rows.
> I would only like 15 of them visible at startup. What is the
> easiest way to set the default number of displayable rows?

I had some good results with using setItemCount(int) when creating the
table and filling it with data later:

// create the table and let it be displayed/layed out
Table myTable = new Table(parent, SWT.BORDER);
myTable.setItemCount(15);
parent.layout();

// first remove the 15 empty rows
myTable.removeAll();
// now fill it with the actual data
for (int i=0; i<50; i++){
TableItem ti = new TableItem(myTable, SWT.NONE);
ti.setText("Item no. "+i);
}

This way the table has a height to display only 15 items, the other 35
items are accesible via scrolling the table.

This somoehow has the taste of a dirty hack - but for me it did the trick.

HTH

Christian

--
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net
Previous Topic:Enabled celd in Table
Next Topic:Table with check
Goto Forum:
  


Current Time: Fri Apr 19 05:45:24 GMT 2024

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

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

Back to the top