[SOLVED] component added from custom design menu not shown in the inspector lazarus / 31-LCL ---------------------------------------------------------------------- guest58172 · 2016-06-23 15:09 I have the following custom toolbar. It allows to add remove custom TToolbuttons at design time. When I click to add a new button, it appears in the designer but the component inspector is not updated, i.e the new components are not really added. What's missing here ? 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 TCEToolBar = class(TToolBar)  protected    fDesignMenu: TPopupMenu;    procedure dsgnAddButton(sender: TObject);  public    constructor Create(TheOwner: TComponent); override;    destructor Destroy; override;    procedure CMDesignHitTest(var Message: TCMDesignHitTest); message CM_DESIGNHITTEST;  end; constructor TCEToolBar.Create(TheOwner: TComponent);var  item: TMenuItem;begin  inherited;  if csDesigning in ComponentState then  begin    fDesignMenu := TPopupMenu.Create(nil);    fDesignMenu.Name:= 'CEToolbarDsgnMenu';     item := TMenuItem.Create(fDesignMenu);    item.Caption:= 'add CE tool button';    item.OnClick:= @dsgnAddButton;    fDesignMenu.Items.Add(item);  end;end; destructor TCEToolBar.Destroy;begin  if csDesigning in ComponentState then    fDesignMenu.Free;  inherited;end; procedure TCEToolBar.CMDesignHitTest(var Message: TCMDesignHitTest);begin  inherited;  if not (csDesigning in ComponentState) then    exit;  if Message.Keys <> MK_RBUTTON then    exit;  Message.Result := 0;  fDesignMenu.PopUp(Mouse.CursorPos.x,Mouse.CursorPos.y);end; procedure TCEToolBar.dsgnAddButton(sender: TObject);var  button: TCEToolButton;begin  button := TCEToolButton.Create(self);  button.Parent := self;  button.Style := tbsButton;  ButtonList.Add(button);  ReAlign;end; Edit, actually what's added is not recognized by the toolbar at all because any new button added will have a flat look, even if by default the toolbar style is not flat. ---------------------------------------------------------------------- guest58172 · 2016-06-23 17:27 Actually it neither works if the toolbar inherits from TPanel. Does someone remember the trick to be used so that component added at design time appears in the component tree (so that they're saved with the LFM) ? ---------------------------------------------------------------------- guest58172 · 2016-06-23 18:02 Quote from: BBasile on June 23, 2016, 07:27:44 pmActually it neither works if the toolbar inherits from TPanel. Does someone remember the trick to be used so that component added at design time appears in the component tree (so that they're saved with the LFM) ? Just found in one of the drawer of my memory that the owner of all the components must be a form, so here not the toobar itself.