我创建了一个动态TClientDataSet组件并尝试触发OnCalcFields事件....它没有用。代码看起来像这样......
table := TClientDataset.Create(Application);
table.OnCalcFields := tableCalcFields; //where 'tablecalcfields' is the method defined by me.
table.FieldDefs := Query1.FieldDefs;
table.CreateDataSet;
table.Open;
Query1.First;
while not Query1.Eof do
begin
table.Append;
for I := 0 to Query1.FieldList.Count - 1 do
begin
table.FieldValues[table.FieldList[i].DisplayName] :=
Query1.FieldValues[Query1.FieldList[i].DisplayName];
end;
Query1.next;
table.Post;
end;
DataSource2.DataSet := table;
table.First;
之后我将编辑dbgrid上的信息(datasource2设置为它),此时事件必须触发(如果你有一个设计时组件)
感谢您的回答, 维杰
答案 0 :(得分:0)
代码没有计算字段。