Hi there;
I can't solve this problem. I tried many things (reading VisualCLX, debuging...)
I want to create my own component "TH2mPanel" based on TPanel. And I want to integrate a TLabel subcomponent "TLabelFrom". At design time I can drop my THmPanel in the Form; I can resize it, move it and changing its properties. But not the SubComponent. I changed the way I create the subcomponent in the TH2mPanel.Create method like this
fLabelFrom:= TLabel.Create(AOwner);
fLabelFrom.Parent:= Self;
Now I am able to act on the subcomponent at desing time (move it, resize it...). But each time I will open the form, the TH2mPanel.Create method will add a new TLabel to the form and if I change the creation of TLabel like this
fLabelFrom:= TLabel.Create(nil);
I won't be able to manipulate the subcomponent at desing time.
Please if u have any idea or type, let me know
Thanx
This is the source code of my class.
unit QH2mPanel;
interface
uses
SysUtils, Classes,TypInfo, QControls, QExtCtrls, QStdCtrls, QDialogs;
type
TH2mPanel = class(TPanel)
private
{ Private declarations }
fLabelFrom: TLabel;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
property LabelFrom: TLabel read fLabelFrom write fLabelFrom;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('H2m', [TH2mPanel]);
end;
{ TH2mPanel }
constructor TH2mPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Self.Caption:= ' ';
Self.BevelInner:= bvLowered;
Self.BevelOuter:= bvRaised;
fLabelFrom:= TLabel.Create(AOwner);
fLabelFrom.Parent:= Self;
fLabelFrom.Caption:= 'From';
end;
end.
I can't solve this problem. I tried many things (reading VisualCLX, debuging...)
I want to create my own component "TH2mPanel" based on TPanel. And I want to integrate a TLabel subcomponent "TLabelFrom". At design time I can drop my THmPanel in the Form; I can resize it, move it and changing its properties. But not the SubComponent. I changed the way I create the subcomponent in the TH2mPanel.Create method like this
fLabelFrom:= TLabel.Create(AOwner);
fLabelFrom.Parent:= Self;
Now I am able to act on the subcomponent at desing time (move it, resize it...). But each time I will open the form, the TH2mPanel.Create method will add a new TLabel to the form and if I change the creation of TLabel like this
fLabelFrom:= TLabel.Create(nil);
I won't be able to manipulate the subcomponent at desing time.
Please if u have any idea or type, let me know
Thanx
This is the source code of my class.
unit QH2mPanel;
interface
uses
SysUtils, Classes,TypInfo, QControls, QExtCtrls, QStdCtrls, QDialogs;
type
TH2mPanel = class(TPanel)
private
{ Private declarations }
fLabelFrom: TLabel;
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
published
{ Published declarations }
property LabelFrom: TLabel read fLabelFrom write fLabelFrom;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('H2m', [TH2mPanel]);
end;
{ TH2mPanel }
constructor TH2mPanel.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Self.Caption:= ' ';
Self.BevelInner:= bvLowered;
Self.BevelOuter:= bvRaised;
fLabelFrom:= TLabel.Create(AOwner);
fLabelFrom.Parent:= Self;
fLabelFrom.Caption:= 'From';
end;
end.