[Solved] A component that contains another lazarus / 31-LCL ---------------------------------------------------------------------- lainz · 2017-01-03 22:59 Hi, I'm working on a component that's like this: - Panel -- Listbox A panel containing a listbox. The problem I have is if I add in 'published' the ListBox property and I change it with the object inspector then when I run the program the properties (say for example Items property) is not loaded at all. I create the ListBox on create event of the panel container. The source code is here: https://github.com/bgrabitmap/bgracontrols/blob/master/bclistbox.pas In the source I not publish the property because it doesn't works and well but is usable at least without it. ---------------------------------------------------------------------- minesadorada · 2017-01-04 03:55 Just a guess (a long time since I did it) Use SetSubComponent for the listbox in the register proc and a Propertyeditor for it? Example here: http://wiki.freepascal.org/Poweredby#Other_uses ---------------------------------------------------------------------- lainz · 2017-01-04 04:42 Thanks for your reply, is too late here I will try tomorrow. ---------------------------------------------------------------------- balazsszekely · 2017-01-04 06:18 Hi @lainz, Only publish the properties you need, something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //...type TBCPaperListBox = class(TBCPaperPanel)  private    FListBox: TBCListBox;    function GetListBoxItems: TStrings;    procedure SetListBoxItems(AItems: TStrings);  public    constructor Create(TheOwner: TComponent); override;  published    property Items: TStrings read GetListBoxItems write SetListBoxItems;  end;         //...{ TBCPaperListBox } constructor TBCPaperListBox.Create(TheOwner: TComponent);begin  inherited Create(TheOwner);  Self.ChildSizing.ControlsPerLine := 1;  Self.ChildSizing.LeftRightSPacing := 4;  Self.ChildSizing.TopBottomSpacing := 5;  FListBox := TBCListBox.Create(Self);  FListBox.Align := alClient;  FListBox.Parent := Self;end; function TBCPaperListBox.GetListBoxItems: TStrings;begin  Result := FListBox.Items;end; procedure TBCPaperListBox.SetListBoxItems(AItems: TStrings);begin  if FListBox.Items <> AItems then    FListBox.Items := AItems;end; ---------------------------------------------------------------------- lainz · 2017-01-04 13:26 Oh I see. That has some kind of advantages, for example that the user for error clears the ListBox assigned in the property I publish, with your way it will not happen. Edit: Well tested the minesadorada code and works fine. To avoid the user to clear the property we must register the property editor for the class, as displayed in the wiki.