0
동적 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;
내가 (이벤트가 발생한다이 때, (datasource2이 그것을 잘 살고있다) DBGrid를에 대한 정보를 당신이 디자인 타임 구성 요소가있는 경우가됩니다 편집합니다 ... 다음과 같습니다) 답변
덕분에, 비제이
그게 전부입니까? OnCalcFields는 실제로 테이블의 레코드에 데이터 셋을 배치 할 때까지 해고되지 않습니다 ... –
코드가 적어 죄송합니다. 내 게시물을 편집했습니다. –
관련이 있는지는 잘 모르지만 owner Application을 사용하여 데이터 세트를 만드는 것이 이상하게 보입니다. 일반적으로 이것은 폼 또는 데이터 모듈입니다. –