[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] SWT. Table with Table Editor

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.