Hi,
I have a table of style SWT.CHECK with two columns Type and value.
The Type column contains the combo button and Value column contains editable Text
On the selection of Add button the table rows are created.
The code is
public void addTableItems(){
TableEditor tableEditor = new TableEditor(table);
TableItem tableItem = new TableItem(table, SWT.NONE);
tableItem.setChecked(true);
Combo cmb = new Combo(table, SWT.READ_ONLY);
cmb.add("Type1");
cmb.add("Type2");
cmb.add("Type3");
cmb.select(0);
cmb.pack();
cmb.setSize(50,5);
tableEditor.minimumWidth = 50;
tableEditor.horizontalAlignment = SWT.CENTER;
tableEditor.setEditor(cmb, tableItem, 1);
Text txtAddress = new Text(table,SWT.NONE );
txtAddress.pack();
tableEditor = new TableEditor(table);
tableEditor.minimumWidth = 50
tableEditor.horizontalAlignment = SWT.LEFT;
tableEditor.setEditor(txtAddress, tableItem, 2);
}
I need to delete the checked rows and also I need the values of individual controls. How can I get this??
I tried with the following code
private void deleteTableItems() {
TableItem[] tableItems = table.getItems();
for(int i=0;i<tableItems.length;i++){
if(tableItems[i].getChecked()){
table.remove(i);
}
}
}
but it is removing only the check button which is the first column element..
Could anyone help ?
Regards,
Srirekha