alitrun
alitrun

Reputation: 1218

How to hide subcomponents in design time in Structure view panel when creating own component (hide <components[1]>)

I'm creating simple component inherited from TControl (Firemonkey). In constructor I wrote :

constructor TControl1.Create(AOwner: TComponent);
begin
  inherited;

  fTest := TLayout.Create(Self);
  fTest.Parent := Self;
end;

How when I place this component to the form, Structure list shows Tlayout as subcomponent as <components1>. How can I hide it? See screenshot.enter image description here

Upvotes: 0

Views: 468

Answers (1)

alitrun
alitrun

Reputation: 1218

Use

  1. SetSubComponent(True);

  2. Owner must be Self

constructor TControl1.Create(AOwner: TComponent);
begin
  inherited;

  fTest := TLayout.Create(Self);
  fTest.SetSubComponent(True);
  fTest.Parent := Self;
end;

Here is also similar question:

How to disable child controls at design-time?

Upvotes: 4

Related Questions