<p>Moin!</p>
<p>Meine Komponente basiert auf TPanel und sie besitzt eine PaintBox.
Wenn ich nun aber auf diese PaintBox zugreifen will (SVGPanel.PaintBox.Canvas...), erhalte ich eine Fehlermeldung der Art "Element besitzt kein übergeordnetes Fenster".</p>
<p>Was ist falsch?</p>
<pre>
unit SVGPanel;
interface
uses
SysUtils, Classes, Controls, ExtCtrls, SVGParser, Dialogs;
type
TSVGPanel = class(TPanel)
private
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
PaintBox : TPaintBox;
published
{ Published-Deklarationen }
constructor create(AOwner: TComponent); override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Beispiele', [TSVGPanel]);
end;
constructor TSVGPanel.create(AOwner : TComponent);
begin
inherited create(AOwner);
PaintBox:=TPaintBox.Create(self);
PaintBox.Align:=alClient;
end;
</pre>
<p>Meine Komponente basiert auf TPanel und sie besitzt eine PaintBox.
Wenn ich nun aber auf diese PaintBox zugreifen will (SVGPanel.PaintBox.Canvas...), erhalte ich eine Fehlermeldung der Art "Element besitzt kein übergeordnetes Fenster".</p>
<p>Was ist falsch?</p>
<pre>
unit SVGPanel;
interface
uses
SysUtils, Classes, Controls, ExtCtrls, SVGParser, Dialogs;
type
TSVGPanel = class(TPanel)
private
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
PaintBox : TPaintBox;
published
{ Published-Deklarationen }
constructor create(AOwner: TComponent); override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Beispiele', [TSVGPanel]);
end;
constructor TSVGPanel.create(AOwner : TComponent);
begin
inherited create(AOwner);
PaintBox:=TPaintBox.Create(self);
PaintBox.Align:=alClient;
end;
</pre>
Comment