I am trying to create composite component TTreePage (descendant form TCustomControl). It should contain 3 subcomponents: Treeview (TTreeview) align:=alLeft, Splitter (TSplitter) align:=alLeft and Container (TPanel) align:=alClient.
here is the contstructor:
constructor TTreePage.Create(AOwner: TComponent);
begin
inherited;
FTreeview := TTreeView.Create(self);
FTreeview.SetSubComponent(True);
InsertControl(FTreeview);
FSplitter := TSplitter.Create(self);
FSplitter.SetSubComponent(True);
FSplitter.Width := 3;
FSplitter.Color := clBlack;
InsertControl(FSplitter);
FContainer:= TPanel.Create(Self);
FContainer.SetSubComponent(True);
FContainer.BevelInner := bvNone;
FContainer.BevelOuter := bvNone;
FContainer.Color := clYellow;
InsertControl(FContainer);
RefreshLayout; // this performs alignment of subcomponents
end;
here is create params procedure:
procedure TTreePage.CreateParams(var Params:TCreateParams);
begin
inherited;
Params.Style := Params.Style + WS_EX_CONTROLPARENT;
ControlStyle := ControlStyle + [csAcceptsControls, csCaptureMouse, csOpaque];
end;
The whole component behaves as the one single block. I am unable to select any of subcomponents (TTreeview, TSplitter or TPanel) by mouse. Yes, I can edit their properties in Object Inspector, but I can not edit for example the width of TTreeview or drag TSplitter. The most important thing for me is to add nodes in TTreeview at design time, but I can not evoke Tree node editor for it.
What should I do?
Thanx