raRegisterFunction
Hi,
I have made sevaral procedures and function wich are added tot the calc tree
in reportbuilder using raRegistering function.
When i add a parameter of type tchart to the signature i get a acces
violation when opening the tree:
result := 'function fillchart(graf:tchart): string;';
do i have to add some other units to the program?
Ruud
I have made sevaral procedures and function wich are added tot the calc tree
in reportbuilder using raRegistering function.
When i add a parameter of type tchart to the signature i get a acces
violation when opening the tree:
result := 'function fillchart(graf:tchart): string;';
do i have to add some other units to the program?
Ruud
This discussion has been closed.
Comments
I tried a simple example here. At first I received an AV and after some
trial and error was able to get it to work by adding some code to the
Initialization section to register the TChart class.
uses
Chart;
Initialization
RegisterClass(TChart);
raRegisterFunction('fillchart', TmyTestChartFunction);
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
i tried the same here but it did not make a difference,
any other suggestions?
kind regards,
Ruud
r.bernards@meurs-software.nl
- Here is a copy teh myChartFunc.pas unit that I created and used for
testing. Try a test using this same code.
unit myChartFuncs;
interface
uses
Sysutils, classes,
raFunc,
ppRTTI,
ppChrt,
Chart;
type
TmyChartFunction = class(TraSystemFunction)
public
class function Category: String; override;
end;
TmyFillChartFunction = class(TmyChartFunction)
public
procedure ExecuteFunction(aParams: TraParamList); override;
class function GetSignature: String; override;
end;
implementation
{******************************************************************************
*
** C H A R T F U N C T I O N S
*
{******************************************************************************}
{------------------------------------------------------------------------------}
{ TmyChartFunction.Category }
class function TmyChartFunction.Category: String;
begin
Result := 'Chart';
end;
{------------------------------------------------------------------------------}
{ TmyFillChartFunction.GetSignature }
class function TmyFillChartFunction.GetSignature: String;
begin
Result := 'function FillChart(aChart: TCustomChart): string;';
end;
{------------------------------------------------------------------------------}
{ TmyFillChartFunction.ExecuteFunction }
procedure TmyFillChartFunction.ExecuteFunction(aParams: TraParamList);
var
lChart: TCustomChart;
lsResult: String;
begin
// simple test function, that returns the Name of the chart control
GetParamValue(0, lChart);
lsResult := lChart.Name;
SetParamValue(1, lsResult);
end;
initialization
registerClass(TChart);
raRegisterFunction('FillChart', TmyFillChartFunction);
end.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
something else (integer)then i don't get the error
class function TmyFillChartFunction.GetSignature: String;
begin
Result := 'function FillChart(aChart:TCustomChart): string;';
end;
My own procedure works there as wel.
the settings for search/lib path etc. are the same.
if i use a chart in the report it works so the tchart or tcustomschart are
known to the program.
i don't understand....
That is a mystery indeed, there must a difference between the two somewhere.
I canoot think of anything that would cause it to not work in another
application, except that perhaps theTChart or TCustomChart class is not
registered with Delphi (i.e. with the Delphi RegisterClass call).
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com