TAChart: Auto-rename tools when the toolset name changes

git-svn-id: trunk@29332 -
This commit is contained in:
ask 2011-02-02 17:38:10 +00:00
parent c25cf46ae6
commit ba99b14873
2 changed files with 14 additions and 3 deletions

View File

@ -55,7 +55,6 @@ object Form1: TForm1
Pen.Style = psDash
Pen.Width = 2
Position = -1.5
SeriesColor = clLime
end
object ChartLine2: TConstantLine
LineStyle = lsVertical
@ -63,7 +62,6 @@ object Form1: TForm1
Pen.Style = psDash
Pen.Width = 2
Position = 1.5
SeriesColor = clFuchsia
end
end
object Panel1: TPanel

View File

@ -95,7 +95,7 @@ type
TChartToolClass = class of TChartTool;
TChartTools = class(TFPList)
TChartTools = class(TIndexedComponentList)
end;
{ TChartToolset }
@ -105,6 +105,8 @@ type
FIsHandled: Boolean;
FTools: TChartTools;
function GetItem(AIndex: Integer): TChartTool;
protected
procedure SetName(const AValue: TComponentName); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -659,6 +661,17 @@ begin
Tools.Move(i, Order);
end;
procedure TChartToolset.SetName(const AValue: TComponentName);
var
oldName: String;
begin
if Name = AValue then exit;
oldName := Name;
inherited SetName(AValue);
if csDesigning in ComponentState then
Tools.ChangeNamePrefix(oldName, AValue);
end;
{ TBasicZoomTool }
constructor TBasicZoomTool.Create(AOwner: TComponent);