[TWinControl] creation composant
Bonjour a tous,
J'ai créé un petit compo de classe TWinControl contenant 2 panels.
Tout fonctionne bien sauf lorsque j'ajoute un Label (par ex) sur mon compo en mode design, il devient nil lors de l'execution... Pourquoi ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
type
TKMultiPanel = class(TWinControl)
private
FPanel1 : TPanel;
FPanel2 : TPanel;
procedure SetPanel1(const Value: TPanel);
procedure SetPanel2(const Value: TPanel);
public
constructor Create(AOwner: TComponent); override;
published
property Panel1 : TPanel read FPanel1 Write SetPanel1;
property Panel2 : TPanel read FPanel2 Write SetPanel2;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Compos', [TKMultiPanel]);
end;
{ TKMultiPanel }
constructor TKMultiPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FPanel1 := TPanel.Create(Self);
FPanel1.Parent := Self;
FPanel2 := TPanel.Create(Self);
FPanel2.Parent := Self;
ReplacePositionPanel; // placer les panels
end; |
D'avance merci.