|
|
Re: Table. Default Displayable Rows [message #459590 is a reply to message #459552] |
Thu, 11 August 2005 18:29 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.01689 seconds