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

风流意气都作罢 提交于 2021-01-29 06:23:35

问题


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.


回答1:


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?



来源:https://stackoverflow.com/questions/50202133/how-to-hide-subcomponents-in-design-time-in-structure-view-panel-when-creating-o

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!