Zweistein
Zweistein

Reputation: 343

How to remove a CCombo from a Table in SWT

I added a CCombo to a column of a table item:

TableEditor ceditor = new TableEditor(table);
...
ceditor.setEditor(combo, item, columnIndex);

In the ... part I added a SelectionListener and so on.

I added the functionality of removing table items. If you do so, the CCombo remains on the Table and is not connected to any item (so if you click on it the program crashes). How can I remove the CCombo of this column?

Upvotes: 1

Views: 160

Answers (1)

Rüdiger Herrmann
Rüdiger Herrmann

Reputation: 21025

Before removing the table column, you should remove the corresponding table editor with tableEditor.dispose().

Disposing of the table editor leaves the combo intact. Hence you need to hide the combo if you plan to reuse it with another column/table editor or also dispose of it entirely.

Upvotes: 2

Related Questions