Page 1 of 1

TGridBandTool Duplicate Name

Posted: Tue Mar 07, 2006 4:12 pm
by 9345419
Hi

When I apply a theme to my chart using the ApplyChartTheme method, 2 TGridBandTool objects are added to the grid's declaration, both with the same name GridBandTool1.

object GridBandTool1: TGridBandTool
Band1.Color = 15329769
Band2.Color = clWhite
AxisID = 2
end
object GridBandTool1: TGridBandTool
Band1.Color = 15329769
Band2.Color = clWhite
AxisID = 2
end

This does not cause an error immediately. However the user has the ability to then save the current chart settings to a database using SaveChartToStream. When the settings are later reloaded using LoadChartFromStream, I get an error message.

What is causing this behaviour?

Posted: Wed Mar 08, 2006 8:56 am
by narcis
Hi nathean,

I haven't been able to reproduce what you report. Using v7.06 and the code below, the generated .tee file only has one TGridBandTool object declared on it. Could you please modify the code or send an example we can run "as-is" to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

BTW: Which TeeChart version are you using?

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, TeeComma, ExtCtrls, TeeProcs, TeEngine, Chart, TeeThemes,
  Series, TeeStore, TeeEditPro;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    TeeCommander1: TTeeCommander;
    Button1: TButton;
    Series1: TBarSeries;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  ApplyChartTheme(TFactsTheme,Chart1,-1);
  SaveChartToFile(Chart1,'e:\temp\theme.tee',true,true);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues();
end;

end.