Thank you Mattias,
unique names solved the issue, I was wrongly naming frames: MyFrames[i].Name := Format('Frame%d', [i]);
Last question: I am creating Frames within a ScrollBox, but it look like there is a limit of the ScrollBox height to 32768 pixels.
I'd like to display up to 500 questions (Frames), how can I solve this issue?
[image: Inline images 1]
On 30 June 2017 at 22:59, Mattias Gaertner via Lazarus <
Show quoted text 50 lines
wrote:
On Fri, 30 Jun 2017 22:46:17 +0200
Sandro Cumerlato via Lazarus 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
--
_______________________________________________
Lazarus mailing list
http://lists.lazarus-ide.org/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170630/f9cfb3fa/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: ScrollBox.png
Type: image/png
Size: 6031 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170630/f9cfb3fa/attachment.png>