VIRTUAL - how to use it? [message #458422] |
Wed, 13 July 2005 09:29  |
Eclipse User |
|
|
|
Is there any doc (explanation preferred) on the use of SWT.VIRTUAL style
with the Table? I can't make sense of the javadocs, and if I try the style
all I get no data displayed.
Thanks,
Alex.
|
|
|
|
|
Re: VIRTUAL - how to use it? [message #458459 is a reply to message #458427] |
Wed, 13 July 2005 15:47  |
Eclipse User |
|
|
|
Thanks Axel!
Now it makes sense.
"Axel Schlueter" <axel_eclipse@pqrs.de> wrote in message
news:db38at$gh0$1@news.eclipse.org...
> Axel Schlueter wrote:
>>> Is there any doc (explanation preferred) on the use of SWT.VIRTUAL style
>>> with the Table? I can't make sense of the javadocs, and if I try the
>>> style all I get no data displayed.
>> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet151.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
>
> Ok, you wrote "explanation preferred", sorry :) When using
> the SWT.VIRTUAL style flag, the table will query a listener
> for the rows currently visibile instead of having the program
> to fill the table with all rows at once.
>
> So basically you have to add a listener to the table
> which creates the necessary table items on the fly
>
> table.addListener(SWT.SetData, new Listener() {
> public void handleEvent(Event e) {
> TableItem item = (TableItem)e.item;
> int index = table.indexOf(item);
> item.setText("Item "+data[index]);
> }
> });
>
> and inform the table about the maximum number of rows
> your listener could provide:
>
> table.setItemCount(data.length);
> table.clearAll();
>
> Hope that helps,
> Axel
|
|
|
Powered by
FUDForum. Page generated in 0.03175 seconds