Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT. Table with Table Editor
SWT. Table with Table Editor [message #486073] Wed, 16 September 2009 04:53 Go to next message
El_justiciero  is currently offline El_justiciero
Messages: 13
Registered: July 2009
Junior Member
Hello,

We are creating a Table with different type of items. To carry out it we
use one Table Item per row and one Table Editor per column. The problem is
that we donŽt know how to get the data (items) from the table, Here some
example code:

Table table = new Table(atributeGroup, SWT.BORDER | SWT.V_SCROLL);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
String[] titles = {"PK","Nombre", "Tipo", "Relación"};
for (int i=0; i<titles.length; i++) {
TableColumn column = new TableColumn (table, SWT.NONE);
column.setText (titles [i]);
column.setWidth(103);
}

TableEditor editor = new TableEditor(table);
TableItem item= new TableItem(table, SWT.NONE);
Display display = Display.getCurrent();


Button clave_B= new Button(table, SWT.CHECK);
clave_B.setBackground(display.getSystemColor(SWT.COLOR_WHITE ));
editor.grabHorizontal = true;
editor.setEditor(clave_B, item, 0);

editor = new TableEditor(table);
Text nombre_T= new Text(table, SWT.NONE);
editor.grabHorizontal = true;
editor.setEditor(nombre_T, item, 1);

editor = new TableEditor(table);
CCombo tipo_CC = new CCombo(table, SWT.NONE);
tipo_CC.add("String");

tipo_CC.setEditable(false);

editor.grabHorizontal = true;
editor.setEditor(tipo_CC, item, 2);

editor = new TableEditor(table);
CCombo relacion_CC = new CCombo(table, SWT.NONE);
relacion_CC.setEditable(false);
relacion_CC.add("1 ... 1");

editor.grabHorizontal = true; editor.setEditor(relacion_CC, item,
3);

Ones the user introduce data in each field, How can we recover this
information? ItŽs mean recover each Button, Text and CCombo from the Table
table variable.

Thank you in advance.
Re: SWT. Table with Table Editor [message #486415 is a reply to message #486073] Thu, 17 September 2009 10:28 Go to previous messageGo to next message
Grant Gayed is currently offline Grant Gayed
Messages: 2148
Registered: July 2009
Senior Member
Hi,

The editors are not available through the Table instance. Can't you just
store them somewhere (eg.- in fields? In Table.setData(columnNumber,
editor)? etc.)

Grant


"El_justiciero " <j_r_conejo@hotmail.com> wrote in message
news:5da8b58952504450283f1100f8de74f1$1@www.eclipse.org...
> Hello,
>
> We are creating a Table with different type of items. To carry out it we
> use one Table Item per row and one Table Editor per column. The problem is
> that we don
Re: SWT. Table with Table Editor [message #487440 is a reply to message #486415] Wed, 23 September 2009 05:41 Go to previous message
El_justiciero  is currently offline El_justiciero
Messages: 13
Registered: July 2009
Junior Member
Hello Grant,

Thank you for answer me, finally I will do that you say me, also I have thought to save the pointer into array list, but I will use the method setData.

Thank you again.

Best Regards.
Previous Topic:NoClassDefFoundError
Next Topic:TreeViewer with Columns Redraw issue
Goto Forum:
  


Current Time: Mon Jul 28 22:46:19 EDT 2014

Powered by FUDForum. Page generated in 0.01606 seconds