开发者

unable fire an event for dynamically created component

开发者 https://www.devze.com 2023-01-03 00:59 出处:网络
I have created a dynamic TClientDataSet component and tried to fire the OnCalcFields event....it has\'nt worked. The code looks like this...

I have created a dynamic TClientDataSet component and tried to fire the OnCalcFields event....it has'nt worked. The code looks like this...

 table := TClientDataset.Create(Application);
  table.OnCalcFields := tableCalcFields; //where 'tablecalcfields' is the method define开发者_如何学Cd 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;

after this i will edit the information on the dbgrid(datasource2 is setted to it), at this time the event must fire (if you have a design time component it will)

thanks for answers, Vijay


The code doesn't have calculated fields.

0

精彩评论

暂无评论...
验证码 换一张
取 消