Much like others have posted here, this is how I have approached this problem. I'm using an array of frames, but you can do the same thing when making several independent frames at runtime.
unit formUnitMain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
types, ExtCtrls, Buttons, ComCtrls, unitTypeTile;
type
{ TformMain }
TformMain = class(TForm)
ScrollBox1: TScrollBox;
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
FrameTypeTile : array of TframeTypeTile; // My frames
end;
var
formMain: TformMain;
implementation
{$R *.lfm}
{ TformMain }
procedure TformMain.FormCreate(Sender: TObject);
var
i : Integer;
fileList : TStringList;
begin
// I do some processing here to get a list of files (fileList) for my particular application
SetLength(FrameTypeTile, 1); // FrameTypeTile is the frame I designed
for i := fileList.Count-1 downto 0 do // Use downto so my frames are in the right order when using align:=alTop
begin
SetLength(FrameTypeTile, Length(FrameTypeTile)+1);
FrameTypeTile[i] := TframeTypeTile.Create(formMain); // Who owns the frame(s)
FrameTypeTile[i].Name := ''; // Blank works just fine!
FrameTypeTile[i].Parent := ScrollBox1; // Where the frame will be placed
FrameTypeTile[i].Align := alTop;
end;
end;
end.
Hope it helps.