Tool problem

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
thr4sh3r
Newbie
Newbie
Posts: 9
Joined: Tue May 09, 2006 12:00 am

Tool problem

Post by thr4sh3r » Fri Aug 04, 2006 11:44 am

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

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Aug 07, 2006 9:11 am

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.

thr4sh3r
Newbie
Newbie
Posts: 9
Joined: Tue May 09, 2006 12:00 am

Post by thr4sh3r » Mon Aug 07, 2006 11:44 am

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?

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Aug 07, 2006 1:26 pm

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.

thr4sh3r
Newbie
Newbie
Posts: 9
Joined: Tue May 09, 2006 12:00 am

Post by thr4sh3r » Tue Aug 08, 2006 8:47 am

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...

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Aug 21, 2006 10:07 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply