DBGrid本来就必须和DataSet结合在一起,
在继承DBGrid的同时,有必要在其DataSet中的事件工作,
type
TXDBGrid = class(TDBGrid)
private
FDataset:TDataset;
protected
procedure DataSetAfterEdit(DataSet: TDataSet);//有什么办法从TDataSet中
procedure DataSetAfterPost(DataSet: TDataSet); 继承下来
procedure LinkActive(Value: Boolean); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
implementation
procedure TXDBGridEh.LinkActive(Value: Boolean);
begin
if Value then
begin
FDataset := TDataset.Create(nil);
FDataset := Datasource.DataSet;
end;
inherited LinkActive(Value);
end;