Creating arrays of fields lazarus / 31-LCL ---------------------------------------------------------------------- WalterK · 2011-06-25 23:46 I need to make a form with sixteen sets of fields.  (About 12 fields in each, I think.) I see this post http://www.lazarus.freepascal.org/index.php/topic,11454.msg57542.html# msg57542 shows how to access them via an array once created, but I'd like to create (and access) them without brute-force creating them all a design time. Is this possible? TIA. Walter ---------------------------------------------------------------------- fabienwang · 2011-06-26 05:39 Indeed it is possible to create components by code. Here is an example for your project: 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 ...    { public declarations }    AmountEdit:  array[1..12] of TEdit;... procedure TForm1.FormCreate(Sender: TObject);var  i: Integer;begin  for i:=0 to Length(AmountEdit) - 1 do  begin    AmountEdit[i] := TEdit.Create(self);    AmountEdit[i].parent := self;    AmountEdit[i].left := 5;    AmountEdit[i].top := i*30 + 5;  end;  self.height := AmountEdit[i].top + 50;end; ---------------------------------------------------------------------- Zoran · 2011-06-26 06:05 Take a look at the small application attached to this old post: http:/ /www.lazarus.freepascal.org/index.php/topic,8912.msg43287.html#msg4328 7 ---------------------------------------------------------------------- WalterK · 2011-06-26 16:23 Got it working.  Thanks! NOW, I'd like to put these sets of forms into a ScrollBox (or similar) so I can scroll through the data sets when enough of them are populated to fill up the form.  I placed a ScrollBox on the form and created the fields this way:  EqnRec := TEdit.Create(ScrollBox1);  This does not work, however, showing only the created fields as if on the main form, and there being no visible ScrollBox. Am I using the right component?  (I see there have been a few issues with TScrollBox.)  Do I need to create these fields after CreateForm, perhaps? Thanks to anyone who can help. ---------------------------------------------------------------------- WalterK · 2011-06-26 21:54 OK, pretty dum of me... I should have set the parent...   I changed the parent line to: EqnRec.parent := ScrollBox1; And it works fine.  Sorry to be a bother.