Page 1 of 1

Tool problem

Posted: Fri Aug 04, 2006 11:44 am
by 9346270
Who can help me? Narcis is away.

Ill need to show you quite a bit of code and explain what its doing. :shock:
Anyone up for it?

It to do with CloneTools, when i do this it doesnt keep the properties Snapstyle etc. I need it to keep these properties. The problem is, all my charts are created dynamically at runtime.

Thanks in advance.

Regards
Justin

Posted: Mon Aug 07, 2006 9:11 am
by Pep
Hi Justin,

are you using similar code to the following to clone the Chart tools ?

Code: Select all

Function CloneChartTool(ATool:TTeeCustomTool; AOwner: TComponent):TTeeCustomTool; 
begin 
  result:=TTeeCustomToolClass(ATool.ClassType).Create(AOwner); 
  result.Assign(ATool); 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
var i: Integer; 
begin 
  Chart2.Tools.Clear; 
  Chart2.Assign(Chart1); 
  for i:=0 to Chart1.Tools.Count-1 do 
    CloneChartTool(Chart1.Tools[i],Chart2).ParentChart:=Chart2; 
  EditChart(Self,Chart2); 
end; 
The above code might help you clone only chart tools. But you might have to add additional safeguards if for example a tool is connected to specific series and the destination chart doesn't have this series type.

Posted: Mon Aug 07, 2006 11:44 am
by 9346270
Yeah, that is exactly the problem.

The problem comes in because my charts are created dynamically by the user at runtime.

Any ideas on how to fix?

Posted: Mon Aug 07, 2006 1:26 pm
by Pep
Hi,

in that case, the only way around this that I know of would be to check which tool type must be copied and depending of the type check the properties which has not been copied and assign them manually.

Posted: Tue Aug 08, 2006 8:47 am
by 9346270
I did try this. I am not an idiot. But i cant get the properties to assign the properly to the Tool. Because of all the arrays and the dynamic creation of the charts.

Can you help me more specifically?

I can send you the code or something...

Posted: Mon Aug 21, 2006 10:07 am
by narcis
Hi thr4sh3r,

Please send us a project we can run "as-is" to reproduce the problem here at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.