[Lazarus] Questionnaire GUI component

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Jun 30 22:59:51 CEST 2017


On Fri, 30 Jun 2017 22:46:17 +0200
Sandro Cumerlato via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> Thank you Adrian for your reply,
> I can create a good layout with Frames, but it looks like I cannot create
> multiple frames on the same form... Duplicate name: A component named
> "Frame1" already exists.
> 
> I tried to create an array of Frames at runtime:
> 
> Question 1? (Option A) (Option B)
> Question 2? (Option A) (Option B)
> Question 3? (Option A) (Option B)
> Question 4? (Option A) (Option B)
> ...
> Question 200? (Option A) (Option B)
> 
> 
> var
>   MyFrames: array[1..200] of TFrame1;
> 
> 
> Where am I wrong?

Give your frames unique names.

DisableAutoSizing;
try
  for i:=1 to 200 do begin
    MyFrames[i]:=TFrame1.Create(Self);
    with MyFrames[i] do begin
      Name:='MyFrame'+IntToStr(i);
      Top:=i*Height;
      Parent:=Self;
    end;
  end;
finally
  EnableAutoSizing;
end;


Mattias


More information about the Lazarus mailing list