title: Delphi - Add a Buttons property to component
body: <p>I am making a Delphi DB aware component and i need to add a 'buttons' property, which should show with the ... button in the object inspector and after clicking the ... button a list should be shown to see the defined buttons, add, delete button definitions, i only know basics on component design and i'm puzzled on how to make this work.</p>
  
  <p>The buttons definition of course has to be saved in the dfm file.
  I have been reading the question in this thread:
  <a href="https://stackoverflow.com/questions/37500480/how-can-i-make-a-tlist-property-from-my-custom-control-streamable">How can I make a TList property from my custom control streamable?</a> but the 'fItems:=TCollection.Create' statement in the constructor won't compile (error E2029 '(' expected but ')' found')</p>
  
  <p>Does anyone see what i am doing wrong and/or can anyone provide a example of how to make a dynamic list of buttons in the component?</p>
  
  <pre><code>type
  TAlignment = (Horizontal, Vertical);
  
  TButtonsItem = class (TCollectionItem)
  private
      FButton: TcxButton;
  published
      property Button: TcxButton read FButton write FButton;
  end;
  
  TButtonsItemClass = class of TButtonsItem;
  
  TFlexButtonGroupBox = class(TcxGroupBox)
  private
      FDataLink: TFieldDataLink;
      FAbout: string;
      fAlignment: TAlignment;
      fEnabled: Boolean;
      fButtons: TCollection;
      procedure SetAlignment(const Value: TAlignment);
      function GetDataField: string;
      function GetDataSource: TdataSource;
      procedure SetDataField(const Value: string);
      procedure SetDataSource(const Value: TdataSource);
      procedure DataChange(Sender: TObject);
      procedure SetEnabled(const Value: Boolean);
  protected
  public
      constructor Create(AOwner: TComponent); override;
      destructor Destroy; override;
  published
      property DataField: string read GetDataField write SetDataField;
      property DataSource: TdataSource read GetDataSource write SetDataSource;
      property Enabled: Boolean read fEnabled write SetEnabled;
      property About: string read FAbout write FAbout;
      property Buttons: TCollection read fButtons write fButtons;
      property Alignment: TAlignment read fAlignment write SetAlignment;
  end;
  </code></pre>
  
  <p>In constructor:</p>
  
  <pre><code>fButtons := TCollection.Create(TButtonsItemClass); &lt;- error
  </code></pre>
  
  <p>Thanks in advance</p>