jeudi 20 avril 2017

Checking checkbox inside table in swt

I have a table with checkboxes inside my table but the problem is when i ticked the checkbox it doesn't print the value of the data but when I unchecked the box using double clicked it prints and the output is doubled where it shouldn't be printing.

output: 
SCKS-006 , 1108 , 10.199.25.101
SCKS-006 , 1108 , 10.199.25.101

and i have this code (i got it from here in SO)

Table table = (Table) e.widget;
            TableItem item = table.getItem(table.getSelectionIndex());
            for (int col = 0; col < table.getColumnCount(); col++)
            {
                if(item.getChecked())
                {
                    item.setChecked(false);
                    System.out.println(item.getText(0) + " , "+ item.getText(1) + " , "+ item.getText(2));
                }
                else
                    item.setChecked(true);
            }




Aucun commentaire:

Enregistrer un commentaire