2013-07-08 22 views
1

我創建組合框的列是這樣的:SWT:如何在組合獲得選擇的值內嵌表

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); 
} 

然後在單擊「確定」我想通過所有的組合框,並收集所有的值是什麼他們存儲。仍然沒有找到如何可能。 謝謝!

回答

2

我只是偶然發現了這個尋找別的東西。我這樣做的方式是使用getChildren():

for(Control control : yourComposite.getChildren()) { 
    if(control instanceof Combo){ 
     ((Combo) control).getText()); 
    } 
}