Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Virtual tables with multiple columns
Virtual tables with multiple columns [message #441659] Thu, 19 August 2004 10:38 Go to next message
Julen Parra is currently offline Julen ParraFriend
Messages: 12
Registered: July 2009
Junior Member
Hi.

IŽm developer for an Eclipse database plugin (quantum at sourceforge.net).
I'm trying to use the new Virtual tables for a database editor. I have
read the docs, and succeeded in creating a table, but only with one
column. There are no examples using more columns, and no obvious way (at
least to me :) of updating the values of columns beyond the first. Can
somebody help me ? ItŽs that the feature isn't there ? It's that I
couldn't find it ? It's that I'm posting in the wrong newsgroup :o) ?

Thanks in advance.
Re: Virtual tables with multiple columns [message #441661 is a reply to message #441659] Thu, 19 August 2004 12:29 Go to previous messageGo to next message
Rob Warner is currently offline Rob WarnerFriend
Messages: 9
Registered: July 2009
Junior Member
Create more than one column:

TableColumn tc1 = new TableColumn(table, SWT.NONE);
tc1.setText("Column #1");
TableColumn tc2 = new TableColumn(table, SWT.NONE);
tc2.setText("Column #2");
...

Set text in specific columns--pass the zero-based column index as first
parameter:

TableItem item = new TableItem(table, SWT.NONE);
item.setText(0, "Text for col 1");
item.setText(1, "Text for col 2");

Alternatively, pass the text for all columns in an array:

TableItem item = new TableItem(table, SWT.NONE);
item.setText(new String[] { "Text for col 1", "Text for col 2" });

For virtual tables, of course, you set text in your handler:

table.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
TableItem item = (TableItem) event.item;
item.setText(0, items[table.indexOf(item)]);
item.setText(1, items[table.indexOf(item)] + " #2");
}
});

HTH

Julen Parra wrote:

> Hi.

> IŽm developer for an Eclipse database plugin (quantum at sourceforge.net).
> I'm trying to use the new Virtual tables for a database editor. I have
> read the docs, and succeeded in creating a table, but only with one
> column. There are no examples using more columns, and no obvious way (at
> least to me :) of updating the values of columns beyond the first. Can
> somebody help me ? ItŽs that the feature isn't there ? It's that I
> couldn't find it ? It's that I'm posting in the wrong newsgroup :o) ?

> Thanks in advance.
Re: Virtual tables with multiple columns [message #441663 is a reply to message #441661] Thu, 19 August 2004 12:51 Go to previous message
Julen Parra is currently offline Julen ParraFriend
Messages: 12
Registered: July 2009
Junior Member
So it was option 2. It was rather obvious, but I couldn't see it :o(

Thanks a lot for the prompt answer. That made my day. I was blissfully
unaware that the setText() function could accept an index. I copied some
example that used "item.setText("Item...");" or something like that, and
thought that was the only form of the function. Should have looked harder
before asking.

Thanks again :)

Rob Warner wrote:

> Create more than one column:

> TableColumn tc1 = new TableColumn(table, SWT.NONE);
> tc1.setText("Column #1");
> TableColumn tc2 = new TableColumn(table, SWT.NONE);
> tc2.setText("Column #2");
> ...

> Set text in specific columns--pass the zero-based column index as first
> parameter:

> TableItem item = new TableItem(table, SWT.NONE);
> item.setText(0, "Text for col 1");
> item.setText(1, "Text for col 2");

> Alternatively, pass the text for all columns in an array:

> TableItem item = new TableItem(table, SWT.NONE);
> item.setText(new String[] { "Text for col 1", "Text for col 2" });

> For virtual tables, of course, you set text in your handler:

> table.addListener(SWT.SetData, new Listener() {
> public void handleEvent(Event event) {
> TableItem item = (TableItem) event.item;
> item.setText(0, items[table.indexOf(item)]);
> item.setText(1, items[table.indexOf(item)] + " #2");
> }
> });

> HTH

> Julen Parra wrote:

> > Hi.

> > IŽm developer for an Eclipse database plugin (quantum at sourceforge.net).
> > I'm trying to use the new Virtual tables for a database editor. I have
> > read the docs, and succeeded in creating a table, but only with one
> > column. There are no examples using more columns, and no obvious way (at
> > least to me :) of updating the values of columns beyond the first. Can
> > somebody help me ? ItŽs that the feature isn't there ? It's that I
> > couldn't find it ? It's that I'm posting in the wrong newsgroup :o) ?

> > Thanks in advance.
Previous Topic:use of MenuDetect event ?
Next Topic:Create a native dialog on Pocket PC device
Goto Forum:
  


Current Time: Fri Apr 26 04:18:23 GMT 2024

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

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

Back to the top