Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » VIRTUAL - how to use it?
VIRTUAL - how to use it? [message #458422] Wed, 13 July 2005 13:29 Go to next message
Alex Shneyderman is currently offline Alex ShneydermanFriend
Messages: 71
Registered: July 2009
Member
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 #458426 is a reply to message #458422] Wed, 13 July 2005 14:20 Go to previous messageGo to next message
Axel Schlueter is currently offline Axel SchlueterFriend
Messages: 41
Registered: July 2009
Member
Alex Shneyderman 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.

Have a look at this snippet:

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

Regards,
Axel
Re: VIRTUAL - how to use it? [message #458427 is a reply to message #458426] Wed, 13 July 2005 14:26 Go to previous messageGo to next message
Axel Schlueter is currently offline Axel SchlueterFriend
Messages: 41
Registered: July 2009
Member
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
Re: VIRTUAL - how to use it? [message #458459 is a reply to message #458427] Wed, 13 July 2005 19:47 Go to previous message
Alex Shneyderman is currently offline Alex ShneydermanFriend
Messages: 71
Registered: July 2009
Member
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
Previous Topic:Sort indicator in table header
Next Topic:Tab Stops/Keyboard Navigation
Goto Forum:
  


Current Time: Sun Oct 25 14:50:35 GMT 2020

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

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

Back to the top