AddProperty ParentChart error

Hi,
I've tried to modify fs_ichartrtti.pas to add ParentChart property to a TCustomSeries:
constructor TFunctions.Create(AScript: TfsScript);
begin
  inherited Create(AScript);
  with AScript do
  begin
(...)

    With AddClass(TCustomSeries, 'TChartSeries') Do
    Begin
        AddProperty('ParentChart','TCustomAxisPanel',GetProp,SetProp);
// even this will not work     AddProperty('ParentChart','TChart',GetProp,SetProp);
    End;

(...)

function TFunctions.GetProp(Instance: TObject; ClassType: TClass; const PropName: String): Variant;
begin
    Result := 0;
    if PropName = 'PARENTCHART'
    then Result := Integer(TCustomSeries(Instance).ParentChart);
end;

{ property handler }
procedure TFunctions.SetProp(Instance: TObject; ClassType: TClass; const PropName: String; Value: Variant);
begin
    if PropName = 'PARENTCHART'
    then TChartSeries(Instance).ParentChart:=TChart(Integer(Value));
//    then TChartSeries(Instance).ParentChart:=TCustomAxisPanel(Integer(Value));
//    then TCustomSeries(Instance).ParentChart:=TCustomChart(Integer(Value));
end;

None of this solutions works: when i compile a fsScript containing Series1.ParentChart it gives the error:
Incompatible types: 'Class TCustomAxisPanel', 'Class:TChart'

How should I do?

Thank you,
Geppo Darkson.


Leave a Comment