Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

own component 'looses' childcontrols

Status
Not open for further replies.

Leuselator

Programmer
Mar 18, 2003
1
CA
Hi all!

Got a principal prob here with selfemade components:
Descendend of TPanel creates dynamicaly a child TPanel on it.
If I place Controls on the ChildPanel in IDE (Designtime) they 'disapear' @ runtime.
Help apreciated

To do a quick test here's da code:

unit TestPanel;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;

type
TTestPanel = class(TPanel)
private
{ Private-Deklarationen }
ChildPanel : TPanel;
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor destroy; override;
published
{ Published-Deklarationen }
end;

procedure Register;

implementation

constructor TTestPanel.Create(AOwner: TComponent);
begin
inherited create(AOwner);
width := 400;
Height := 200;
Caption := ' Motherpanel keeps its controls';
ChildPanel := TPanel.create(AOwner);
ChildPanel.Parent := self;
ChildPanel.left := 5;
ChildPanel.Top :=5;
ChildPanel.Width := 190;
ChildPanel.Height := 190;
ChildPanel.Caption := 'Childpanel looses its controls';
end;

destructor TTestPanel.destroy;
begin
ChildPanel.Free;
inherited;
end;

procedure Register;
begin
RegisterComponents('TestPanel', [TTestPanel]);
end;

end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top