问题
i create a column of comboBoxes like this:
for (int i = 0; i < 5; i++) {
new TableItem(table_1, SWT.NONE);
}
TableItem[] itemsCombo = table_1.getItems();
for (int i = 0; i < 5; i++) {
TableEditor editor_1 = new TableEditor(table_1);
final CCombo comboXX = new CCombo(table_1, SWT.NONE);
comboXX.setItems(allValues);
editor_1.grabHorizontal = true;
comboXX.select(getIndexInLOV(choosenItemList.get(i), allValues));
editor_1.setEditor (comboXX, itemsCombo[i], 0);
}
Then on clicking "Ok" i want to go through all comboBoxes and collect all values what they store. Still haven't found how it possible to fo. Thanks!
回答1:
I just stumbled across this looking for something else. The way I've done this is with getChildren():
for(Control control : yourComposite.getChildren()) {
if(control instanceof Combo){
((Combo) control).getText());
}
}
来源:https://stackoverflow.com/questions/17522314/swt-how-to-get-selected-value-in-combo-which-embeded-in-table