Visual Component List Box ? lazarus / 39-Graphics ---------------------------------------------------------------------- Weitentaaal · 2021-06-28 05:40 Hello Guys, so i wanted to create myself a List wich changes a Runtime. In the attachment u can see how i currently handled it. I want to change this to 1 List where i can add for Example a Group box and then the next components i add will get added below the last one. If there are to much then a scrollbar should appear to go through all those fields. Not every field is shown for certain operations. Is this somehow possible ? ---------------------------------------------------------------------- Handoko · 2021-06-28 06:17 Sorry, cannot fully understood what you said. Did you mean the items in "Anzahl Zonen" will be changed if user change the selected item in "CO2 oder VOC"? ---------------------------------------------------------------------- Weitentaaal · 2021-06-28 07:04 Ignore the File. I wanted to create a ListBox with scrollbar, but instead of Strings i wanted to add Controls like a TEdit or a GroupBox. The List has a maximum height (Length) wich when it getws full a scrollbar should appear. Something like the normal ListBox but with Visual Components instead. For Example if u Check a checkbox or press a button some information(the components) will appear in the ListBox. Edit: To understand my problem: in my attached Picture u can see some Groupboxes. But when i need to extend those boxes there wont be enough space to display it so i thought about a List where u can scroll down to work around my space problems ---------------------------------------------------------------------- dseligo · 2021-06-28 07:15 Put your controls in a TScrollBox (it is in Additional tab in Lazarus' controls). ---------------------------------------------------------------------- lucamar · 2021-06-28 07:18 Rather than a ListBox, which is somewhat specialized to manage strings, why don't you use a normal container like, say, a TScrollBox or even a TFlowPanel? One might understand if you wanted a somewhat "extended" list of strings (e.g. with a check box for each string, like a TCheckListBox), but for arbitrary controls ... Note also that you can easily extend a container with a normal object list, if you want it to manage the contained controls/components, so (mis-)using a list box shouldn't really be your first option, IMHO. ---------------------------------------------------------------------- Weitentaaal · 2021-06-28 07:40 Thanks Guys, i didn't meant to use a ListBox i just wanted to compare it with my Goal. Thanks again ---------------------------------------------------------------------- Handoko · 2021-06-28 08:11 A demo showing how to use TScrollBox. 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 unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, StdCtrls, ExtCtrls; type   { TForm1 }   TForm1 = class(TForm)    ScrollBox1: TScrollBox;    ScrollBox2: TScrollBox;    procedure FormCreate(Sender: TObject);    procedure FormResize(Sender: TObject);  end; var  Form1: TForm1; implementation const  Spacing = 20; {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);var  LabelEdit: TLabeledEdit;  i:         Integer;begin   ScrollBox1.Align                := alLeft;  ScrollBox1.BorderStyle        := bsNone;  ScrollBox1.BorderSpacing.Around := Spacing;  ScrollBox2.Align                := alClient;  ScrollBox2.BorderSpacing.Around := Spacing;  ScrollBox2.BorderStyle        := bsNone;   LabelEdit                   := TLabeledEdit.Create(Self);  LabelEdit.Parent            := ScrollBox1;  LabelEdit.Top               := 20;  LabelEdit.Left            := 8;  LabelEdit.Width             := ScrollBox1.Width - 16;  LabelEdit.Anchors           := [akLeft, akRight, akTop];  LabelEdit.EditLabel.Caption := 'First Name';   LabelEdit                 := TLabeledEdit.Create(Self);  LabelEdit.Parent            := ScrollBox1;  LabelEdit.Top               := 20 +50;  LabelEdit.Left            := 8;  LabelEdit.Width             := ScrollBox1.Width - 16;  LabelEdit.Anchors           := [akLeft, akRight, akTop];  LabelEdit.EditLabel.Caption := 'Last Name';   LabelEdit                 := TLabeledEdit.Create(Self);  LabelEdit.Parent            := ScrollBox1;  LabelEdit.Top               := 70 +50;  LabelEdit.Left            := 8;  LabelEdit.Width             := ScrollBox1.Width - 16;  LabelEdit.Anchors           := [akLeft, akRight, akTop];  LabelEdit.EditLabel.Caption := 'Company';   LabelEdit                 := TLabeledEdit.Create(Self);  LabelEdit.Parent            := ScrollBox1;  LabelEdit.Top               := 120 +50;  LabelEdit.Left            := 8;  LabelEdit.Width             := ScrollBox1.Width - 16;  LabelEdit.Anchors           := [akLeft, akRight, akTop];  LabelEdit.EditLabel.Caption := 'Street';   LabelEdit                 := TLabeledEdit.Create(Self);  LabelEdit.Parent            := ScrollBox1;  LabelEdit.Top               := 170 +50;  LabelEdit.Left            := 8;  LabelEdit.Width             := ScrollBox1.Width - 16;  LabelEdit.Anchors           := [akLeft, akRight, akTop];  LabelEdit.EditLabel.Caption := 'City';   for i := 1 to 7 do  begin    LabelEdit                   := TLabeledEdit.Create(Self);    LabelEdit.Parent            := ScrollBox2;    LabelEdit.Top             := -30 + i*50;    LabelEdit.Left              := 8;    LabelEdit.Width             := ScrollBox2.Width - 16;    LabelEdit.Anchors           := [akLeft, akRight, akTop];    LabelEdit.EditLabel.Caption := 'Item' + i.ToString;  end; end; procedure TForm1.FormResize(Sender: TObject);begin  ScrollBox1.Width := (Width - 3*Spacing) div 2;end; end. Change the line #27 to see the difference. You can remove the line #40, #44 if you want the see the border. And you should resize the form at runtime to see what will happen. ---------------------------------------------------------------------- Weitentaaal · 2021-06-28 09:06 Thanks @Handoko for your Example, perfect to understand TScrollBox