unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DBCtrls, Grids, DBGrids, ExtCtrls, TeeProcs, TeEngine,
Chart, DbChart,
DB, DBTables;
type
TForm1 =
class(TForm)
DBChart1: TDBChart;
DBGrid1: TDBGrid;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
procedure CalcField(DataSet: TDataset);
public
Tab1 :TTable;
DS1 :TDataSource;
Grid1 :TDBGrid;
CalcFields :TFloatField;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Tab1 := TTable.Create(Self);
with Tab1
do begin
AutoCalcFields := True;
DatabaseName := '
c:\Aktien\';
TableName := '
Aktienchart';
TableType := ttParadox;
OnCalcFields := CalcField;
with FieldDefs
do begin
Clear;
Add('
WKN', ftString, 6, false);
Add('
Datum', ftDate, 20, false);
Add('
Kurs', ftFloat, 20, false);
FieldDefs[0].CreateField(Tab1);
FieldDefs[1].CreateField(Tab1);
FieldDefs[2].CreateField(Tab1);
CalcFields := TFloatField.Create(Tab1);
with CalcFields
do begin
FieldName := '
GD1';
Calculated := True;
Visible := True;
DataSet := Tab1;
Name := '
Gleitender Durchschnitt1';
Tab1.FieldDefs.Add(
Name, ftFloat, 0, false);
end;
end;
Tab1.CreateTable;
end;
end;
end.