Function Declarations
Posted: Tue Jan 04, 2005 1:11 am
We are using Teechart VI and Delphi V and have a problem using functions. we made a simple example[below]. What happens is that
when we compile, the compiler says the calcuilate method cannot be found.
Thanks,
Jennifer
**********************************************************
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type
Tderivfunction=Class(TTeefunction);
TForm1 = class(TForm)
Chart1: TChart;
Series1: TFastLineSeries;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
end;
var
Form1: TForm1;
Function Tderivfunction.calculate(SourceSeries:TchartSeries;
first,last:Longint):Double;
implementation
{$R *.DFM}
Function Tderivfunction.calculate(SourceSeries:TchartSeries;
first,last:Longint):Double;
VAR
kk:Integer;
startpoint,endpoint:LongInt;
BEGIN
IF First <>-1 Then startpoint:=first;
IF Last <>-1 Then endpoint:=Last;
FOR kk:=startpoint to endpoint Do
result:=sourceseries.getYvalue(kk+1)-
sourceseries.getYvalue(kk-1);
END;
procedure TForm1.FormActivate(Sender: TObject);
begin
end;
end.
when we compile, the compiler says the calcuilate method cannot be found.
Thanks,
Jennifer
**********************************************************
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs,TeEngine, Series, ExtCtrls, TeeProcs, Chart;
type
Tderivfunction=Class(TTeefunction);
TForm1 = class(TForm)
Chart1: TChart;
Series1: TFastLineSeries;
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
end;
var
Form1: TForm1;
Function Tderivfunction.calculate(SourceSeries:TchartSeries;
first,last:Longint):Double;
implementation
{$R *.DFM}
Function Tderivfunction.calculate(SourceSeries:TchartSeries;
first,last:Longint):Double;
VAR
kk:Integer;
startpoint,endpoint:LongInt;
BEGIN
IF First <>-1 Then startpoint:=first;
IF Last <>-1 Then endpoint:=Last;
FOR kk:=startpoint to endpoint Do
result:=sourceseries.getYvalue(kk+1)-
sourceseries.getYvalue(kk-1);
END;
procedure TForm1.FormActivate(Sender: TObject);
begin
end;
end.