|
Re: Virtual tables with multiple columns [message #441661 is a reply to message #441659] |
Thu, 19 August 2004 12:29 |
Rob Warner 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 |
Julen Parra 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.
|
|
|
Powered by
FUDForum. Page generated in 0.03052 seconds