Question:
In Delphi, how to create a TEdit inside a TPanel that is part of a dynamic array at runtime?
oxyzenium
2008-07-11 16:17:16 UTC
I created an array at runtime, set it's dimension, but I also need to create 3 TEdits inside each TPanel. I was looking into multidimensional arrays, but it seems that anything within a multidimensional array must be of the same type (such as TPanel).
Three answers:
LeoS
2008-07-11 16:27:49 UTC
Tried creating a multidimensional array of TObject?



Sorry, haven't done Delphi programming in a while. The folks over at the CodeGear newsgroups are generally quite helpful though. http://support.codegear.com/newsgroups
tapley
2016-12-10 17:46:50 UTC
Delphi Tedit
Heri
2008-07-14 08:08:49 UTC
do you mean like this code?



var a:array [0..2] of TPanel;

b:array [0..2] of TEdit;

i,y:Integer;

begin

y:=2;

for i:=0 to 2 do begin

a[i]:=TPanel.Create(Self);

a[i].Height :=25;

a[i].Top :=y;

a[i].Parent :=self;

y:=y+25;

end;

for i:=0 to 2 do begin

b[i]:=TEdit.Create(a[i]);

b[i].Height :=25;

b[i].Top :=1;

b[i].Parent :=a[i];

end;



I know ..its not dynamic array, but you can do it like that in dynamic array.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...