Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic Component creation Delphi7
    primarykey
    data
    text
    <p>I have to create Editboxes dynamically, which I am creating using loop (loop variable j). 5 components are created successfully, but in 6th component, array shows nil (in debugging process), i.e. nothing was created actually. Again 7th and 8th components are created successfully but 9th doesn't. I have declared variables like- </p> <pre><code> sud,eud,fud,a,e,c,d,na,st1,st2,citye,statee,pinne,cn,cr,cb,ca: array [0..9] of TEdit; crr,vcl: array [0..9] of TEdit; </code></pre> <p>All other components which I declared above are created successfully in that loop.</p> <pre><code> crr[j+3]:=tEdit.Create(coregroup[i]); crr[j+3].Parent:=coregroup[i]; crr[j+3].Top:= 77; crr[j+3].Left:=83+(j*57); crr[j+3].Width:=17; </code></pre> <p>I am in the same situation with the code for last two days. If more clarification is required, I may provide you.</p> <p>The actual code is-</p> <pre><code>sud,eud,fud,a,e,c,d,na,st1,st2,citye,statee,pinne,cn,cr,cb,ca: array [0..9] of TEdit; crr,vcl: array [0..9] of TEdit; dud,leud,lfud,b,f,g,h,nal,st1l,st2l,cityel,stateel,pinnel,dt,cl,crl,cbl,cal,vce: array [0..9] of TLabel; count,ppointer:integer; rcaldt: array[0..5] of TDateTimePicker; coregroup:array of TGroupBox; var i,j,kk,aa,x:integer; divv:array[0..3] of Tlabel; u,m,k:integer; begin k:=0; m:=0; //kk:=groupbox11.ControlCount-1; SetLength(coregroup,5); for i:=0 to count-1 do begin coregroup[i]:= tGroupbox.Create(groupbox11); coregroup[i].Parent:=groupbox11; coregroup[i].SetBounds(8+(i*223),140,x,170); if ctvt.ItemIndex=0 then coregroup[i].Caption:='C T'+ IntToStr((aa*i)+1) else coregroup[i].Caption:='V T'+ IntToStr((aa*i)+1); cl[0]:= tLabel.Create(coregroup[i]); cl[0].Parent:=coregroup[i]; cl[0].Top:= 20; cl[0].Left:=8; cl[0].Caption:= 'CORE'; cl[0].Font.Style := cl[0].Font.Style + [fsBold]; cbl[0]:= tLabel.Create(coregroup[i]); cbl[0].Parent:=coregroup[i]; cbl[0].Top:= 50; cbl[0].Left:=8; cbl[0].Caption:= 'BURDEN'; cbl[0].Font.Style := cbl[0].Font.Style + [fsBold]; crl[0]:= tLabel.Create(coregroup[i]); crl[0].Parent:=coregroup[i]; crl[0].Top:= 80; crl[0].Left:=8; crl[0].Caption:= 'RATIO'; crl[0].Font.Style := crl[0].Font.Style + [fsBold]; cal[0]:= tLabel.Create(coregroup[i]); cal[0].Parent:=coregroup[i]; cal[0].Top:= 110; cal[0].Left:=8; cal[0].Caption:= 'ACLASS'; //cr,cb,ca cal[0].Font.Style := cal[0].Font.Style + [fsBold]; vce[0]:= tLabel.Create(coregroup[i]); vce[0].Parent:=coregroup[i]; vce[0].Top:= 140; vce[0].Left:=8; vce[0].Caption:= 'VCLASS'; //cr,cb,ca vce[0].Font.Style := cal[0].Font.Style + [fsBold]; for j:=0 to ((StrToInt(ncorct.Text))-1) do begin if cn[j]=nil then begin cn[j]:=tEdit.Create(coregroup[i]); cn[j].Parent:=coregroup[i]; cn[j].Top:= 17; cn[j].Left:=52+(j*57); cn[j].Width:=50; cb[j]:=tEdit.Create(coregroup[i]); cb[j].Parent:=coregroup[i]; cb[j].Top:= 47; cb[j].Left:=71+(j*57); cb[j].Width:=30; cr[j]:=tEdit.Create(coregroup[i]); cr[j].Parent:=coregroup[i]; cr[j].Top:= 77; cr[j].Left:=56+(j*57); cr[j].Width:=17; ca[j]:=tEdit.Create(coregroup[i]); ca[j].Parent:=coregroup[i]; ca[j].Top:= 107; ca[j].Left:=61+(j*60); ca[j].Width:=35; divv[j]:=tLabel.Create(coregroup[i]); divv[j].Parent:=coregroup[i] ; divv[j].Top:=80; divv[j].Left:=74+(j*57); divv[j].Caption:='/'; crr[j]:=tEdit.Create(coregroup[i]); crr[j].Parent:=coregroup[i]; crr[j].Top:= 77; crr[j].Left:=83+(j*57); crr[j].Width:=17; vcl[j]:=tEdit.Create(coregroup[i]); vcl[j].Parent:=coregroup[i]; vcl[j].Top:= 137; vcl[j].Left:=61+(j*60); vcl[j].Width:=35; end else if cn[j+3]=nil then begin cn[j+3]:=tEdit.Create(coregroup[i]); cn[j+3].Parent:=coregroup[i]; cn[j+3].Top:= 17; cn[j+3].Left:=52+(j*57); cn[j+3].Width:=50; cb[j+3]:=tEdit.Create(coregroup[i]); cb[j+3].Parent:=coregroup[i]; cb[j+3].Top:= 47; cb[j+3].Left:=71+(j*57); cb[j+3].Width:=30; cr[j+3]:=tEdit.Create(coregroup[i]); cr[j+3].Parent:=coregroup[i]; cr[j+3].Top:= 77; cr[j+3].Left:=56+(j*57); cr[j+3].Width:=17; ca[j+3]:=tEdit.Create(coregroup[i]); ca[j+3].Parent:=coregroup[i]; ca[j+3].Top:= 107; ca[j+3].Left:=61+(j*60); ca[j+3].Width:=35; divv[j+3]:=tLabel.Create(coregroup[i]); divv[j+3].Parent:=coregroup[i] ; divv[j+3].Top:=80; divv[j+3].Left:=74+(j*57); divv[j+3].Caption:='/'; ***crr[j+3]:=tEdit.Create(coregroup[i]); crr[j+3].Parent:=coregroup[i]; crr[j+3].Top:= 77; crr[j+3].Left:=83+(j*57); crr[j+3].Width:=17;*** vcl[j+3]:=tEdit.Create(coregroup[i]); vcl[j+3].Parent:=coregroup[i]; vcl[j+3].Top:= 137; vcl[j+3].Left:=61+(j*60); vcl[j+3].Width:=35; end else begin cn[j+6]:=tEdit.Create(coregroup[i]); cn[j+6].Parent:=coregroup[i]; cn[j+6].Top:= 17; cn[j+6].Left:=52+(j*57); cn[j+6].Width:=50; cb[j+6]:=tEdit.Create(coregroup[i]); cb[j+6].Parent:=coregroup[i]; cb[j+6].Top:= 47; cb[j+6].Left:=71+(j*57); cb[j+6].Width:=30; cr[j+6]:=tEdit.Create(coregroup[i]); cr[j+6].Parent:=coregroup[i]; cr[j+6].Top:= 77; cr[j+6].Left:=56+(j*57); cr[j+6].Width:=17; ca[j+6]:=tEdit.Create(coregroup[i]); ca[j+6].Parent:=coregroup[i]; ca[j+6].Top:= 107; ca[j+6].Left:=61+(j*60); ca[j+6].Width:=35; divv[j+3]:=tLabel.Create(coregroup[i]); divv[j+3].Parent:=coregroup[i] ; divv[j+3].Top:=80; divv[j+3].Left:=74+(j*57); divv[j+3].Caption:='/'; crr[j+6]:=tEdit.Create(coregroup[i]); crr[j+6].Parent:=coregroup[i]; crr[j+6].Top:= 77; crr[j+6].Left:=83+(j*57); crr[j+6].Width:=17; vcl[j+6]:=tEdit.Create(coregroup[i]); vcl[j+6].Parent:=coregroup[i]; vcl[j+6].Top:= 137; vcl[j+6].Left:=61+(j*60); vcl[j+6].Width:=35; end; end; end; end else begin one.Enabled:=false; onem.Enabled:=false; end; end; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload