Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] problem while removing tableitems in SWT table

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

 

 

 
***** Confidentiality Statement/Disclaimer *****

This message and any attachments is intended for the sole use of the intended recipient. It may contain confidential information. Any unauthorized use, dissemination or modification is strictly prohibited. If you are not the intended recipient, please notify the sender immediately then delete it from all your systems, and do not copy, use or print. Internet communications are not secure and it is the responsibility of the recipient to make sure that it is virus/malicious code exempt.
The company/sender cannot be responsible for any unauthorized alterations or modifications made to the contents. If you require any form of confirmation of the contents, please contact the company/sender. The company/sender is not liable for any errors or omissions in the content of this message.

Back to the top