v.8.01 - Is it a bug? (ChartEditor again)
Posted: Sun Jul 08, 2007 10:27 am
Hello,
In situations when by some reason a chart is updated with Chart Editor dialog opened it is easy to get an exception:
---------------------------
Project1
---------------------------
Control 'TabSeriesList' has no parent window.
---------------------------
OK
---------------------------
Obvious fix would be to avoid such situations, but maybe a better solution is possible? In complicated applications sometimes it is not easy to have full control on when and why a chart is updated.
Below you will find a simple example reproducing the problem:
1) Create a simple VCL application
2) Place TChart, TTimer and TButton on the main form
3) To make the problem more vivid set Chart1.Legend.LegendStyle = lsSeries
4) Arrange the code of Unit1.pas as follows.
You may experiment with commenting different lines in the Button1Click event handler.
Best regards,
Michael
In situations when by some reason a chart is updated with Chart Editor dialog opened it is easy to get an exception:
---------------------------
Project1
---------------------------
Control 'TabSeriesList' has no parent window.
---------------------------
OK
---------------------------
Obvious fix would be to avoid such situations, but maybe a better solution is possible? In complicated applications sometimes it is not easy to have full control on when and why a chart is updated.
Below you will find a simple example reproducing the problem:
1) Create a simple VCL application
2) Place TChart, TTimer and TButton on the main form
3) To make the problem more vivid set Chart1.Legend.LegendStyle = lsSeries
4) Arrange the code of Unit1.pas as follows.
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls, TeeEdit;
type
TForm5 = class(TForm)
Timer1: TTimer;
Button1: TButton;
Chart1: TChart;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Count: Integer;
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
uses EditChar, TeeEditCha;
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
EditChartPage( Self, Chart1, teeEditGeneralPage );
// EditChartPage( Self, Chart1, teeEditAxisPage );
// EditChartPage( Self, Chart1, teeEditMainPage );
end;
procedure TForm5.FormCreate(Sender: TObject);
begin
Count := 0;
Chart1.AddSeries(TFastLineSeries);
Chart1[0].FillSampleValues(100);
Timer1Timer(Self);
end;
procedure TForm5.Timer1Timer(Sender: TObject);
begin
Chart1[0].Title := 'Title ' + IntToStr(Count);
Inc(Count);
if Count >= 10 then
Count := 0;
end;
end.
Best regards,
Michael