I made a following simple component with a nested TeeChart. There nothing more in it.
unit ExperimentalChart;
interface
uses System.Classes, Vcl.Controls, VclTee.TeeGDIPlus, VCLTee.TeEngine,
VCLTee.TeeProcs, VCLTee.Chart;
type
TExperimentalChart = class(TCustomControl)
private
FChart: TChart;
protected
procedure CreateHandle(); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy(); override;
published
end;
procedure Register();
implementation
uses System.SysUtils;
procedure Register();
begin
System.Classes.RegisterComponents('Experimental', [TExperimentalChart]);
end;
constructor TExperimentalChart.Create(AOwner: TComponent);
begin
inherited;
FChart := TChart.Create(nil);
FChart.ClearChart();
FChart.View3D := False;
end;
procedure TExperimentalChart.CreateHandle();
begin
inherited;
FChart.Parent := Self;
FChart.Align := alClient;
end;
destructor TExperimentalChart.Destroy();
begin
FreeAndNil(FChart);
inherited;
end;
end.
When I am using this component at design time and want to move the component on the form, TChart receives all the mouse events and an error box appears:
Cannot focus a disabled or invisible window.
Stack trace:
main thread ($4b54):
50589ae6 +06e vcl190.bpl Vcl.Forms 5675 +6 TCustomForm.SetActiveControl
50589bef +053 vcl190.bpl Vcl.Forms 5716 +8 TCustomForm.FocusControl
5046a506 +012 vcl190.bpl Vcl.Controls 12066 +3 TWinControl.SetFocus
42242810 +074 Tee9190.bpl Vcltee Teeprocs.TCustomTeePanel.MouseDown
422a1be9 +025 Tee9190.bpl Vcltee Chart.TCustomChart.MouseDown
5046318c +08c vcl190.bpl Vcl.Controls 7363 +7 TControl.DoMouseDown
504631db +03f vcl190.bpl Vcl.Controls 7374 +7 TControl.WMLButtonDown
50462b49 +2bd vcl190.bpl Vcl.Controls 7224 +91 TControl.WndProc
50467669 +5c5 vcl190.bpl Vcl.Controls 10039 +153 TWinControl.WndProc
422423a4 +00c Tee9190.bpl Vcltee Teeprocs.TCustomTeePanel.WndProc
50466cac +02c vcl190.bpl Vcl.Controls 9751 +3 TWinControl.MainWndProc
501749c4 +00c rtl190.bpl System.Classes 17010 +5 StdWndProc
75bb3ebb +00b USER32.dll DispatchMessageW
50590dc3 +0f3 vcl190.bpl Vcl.Forms 10288 +23 TApplication.ProcessMessage
50590e06 +00a vcl190.bpl Vcl.Forms 10318 +1 TApplication.HandleMessage
50591141 +0c9 vcl190.bpl Vcl.Forms 10456 +26 TApplication.Run
75916357 +017 KERNEL32.DLL BaseThreadInitThunk
How to inhibit passing events to the chart and allow moving the component at design time?