lazarus 3.4+fpc trunk编译tachart控件出错
原因:
最新的fpc禁止访问private引起的
修改方法:
1、打开lazarus\components\tachart\tadatatools.pas
将function TDataPointDistanceTool.FindRef(
APoint: TPoint; AMode: TDataPointMode; ADest: TDataPointTool.TPointRef;
AOtherEndSeries: TBasicChartSeries): Boolean;
function TDataPointDistanceTool.FindRef( APoint: TPoint; AMode: TDataPointMode; ADest: TDataPointTool.TPointRef; AOtherEndSeries: TBasicChartSeries): Boolean; begin FSeries := nil; if AMode in [dpmSnap, dpmLock] then begin FindNearestPoint(APoint); ADest.GraphPos := FNearestGraphPoint; ADest.Index := PointIndex; if not SameTransformations(FSeries, AOtherEndSeries) then FSeries := nil; end; ADest.Series := FSeries; if FSeries = nil then ADest.GraphPos:=FChart.ImageToGraph(APoint); Result := (FSeries <> nil) or (AMode <> dpmLock); end;
将procedure TDataPointDistanceTool.MouseDown(APoint: TPoint):
PointStart.FSeries := nil;
修改为:
PointStart.Series := nil;
procedure TDataPointDistanceTool.MouseDown(APoint: TPoint); begin if IsActive then exit; if dpdoPermanent in Options then DoHide(GetCurrentDrawer); PointStart.Series := nil; if FindRef(APoint, DataPointModeStart, PointStart, nil) then Activate; PointEnd.Assign(PointStart); Handled; end;
2、lazarus\components\tachart\tatools.pas
修改为以下代码:
TDataPointTool = class(TChartTool) public type TPointRef = class private FGraphPos: TDoublePoint; FIndex: Integer; FSeries: TBasicChartSeries; procedure SetGraphPos(const ANewPos: TDoublePoint); public procedure Assign(ASource: TPointRef); function AxisPos(ADefaultSeries: TBasicChartSeries = nil): TDoublePoint; property GraphPos: TDoublePoint read FGraphPos write SetGraphPos; property Index: Integer read FIndex write FIndex; property Series: TBasicChartSeries read FSeries write FSeries; end; strict private
修改后重新编译就可以。
标签:控件,fpc,nil,PointStart,FSeries,3.4,ADest,tachart,APoint From: https://www.cnblogs.com/qiufeng2014/p/18373774