2014-02-19 51 views
0

我有一個Valuelisteditor看起來像這樣FreePascal的:ValueListEditor操作

Key | Name | 
---------------| 
Car | Audi | 
Nick | Yummi | 
Age | 70 | 

,我想修改2行中的關鍵「尼克」,並保持名稱「Yummi」。
我不想重寫整行。
我只是想改變「暱稱」中的「尼克」。

我該如何在一次罷工中做到這一點?

回答

1

找到你要更改的行,然後更新相應的Cell

var 
    iRow: Integer; 
begin 
    // Find the row containing 'Nick' as the key 
    ValueListEditor1.FindRow('Nick', iRow); 
    // If it was found, update the key value (column 0 of the row) 
    if iRow > -1 then 
    ValueListEditor1.Cells[0, iRow] := 'NewNick'; 
end; 

注意TValueListEditor.Cells基於0,其中列有Keys(列0)和Values(第1列)。