How to solve problem about many panels lazarus / 6-IDE-CodeTools ---------------------------------------------------------------------- ribarvlada · 2011-07-21 18:58 I have 55 panels on my form. Every panel change color, and many others things Example : In Delphi I solve proble like this for i:=201 to 255  begin   Case nPanel of     201: Panel201.Color:=clBlue;     202: Panel202.Color:=clRead;     .     .     .     255: Panel255.Color:=clWhite;  end; end; In clipper I wihil something like this : for i=1 to 55   &("Panel"+STR(i)).Color:=PripadajućaBoja (I know that Clipper dont have command like this, this is onely exaple) next i Can Delphi do this like Clipper? Može li Delphi da odradi nešto ovako kao Clipper? ---------------------------------------------------------------------- typo · 2011-07-21 19:18 Code: [Select]for i:=201 to 255 do     TPanel(FindComponent('Panel' + IntToStr(i))).Color := clBlue; ---------------------------------------------------------------------- ribarvlada · 2011-07-22 07:52 Thamk You !!!! ---------------------------------------------------------------------- ribarvlada · 2011-07-22 07:54 Thank You typo !!! ---------------------------------------------------------------------- m.vincent · 2011-09-26 13:36 Extending Typos answer and adding better/safer type-casting you could use: for i:=201 to 255 do   if ( FindComponent('Panel' + IntToStr(i)) is TPanel) then      (FindComponent('Panel' + IntToStr(i)) as TPanel).Color := clBlue; This way you can iterate through the list of componets on a form and take different action for different component types. Regards, Mike ---------------------------------------------------------------------- Arbee · 2011-09-26 14:20 Although you're absolutely right Mike, I don't think a lot of people would call their comboboxes "panelxxx". ---------------------------------------------------------------------- User137 · 2011-09-26 16:26 I wouldn't make any panel in the design view, but create them manually. Code: [Select]private   myPanel: array[0..255] of TPanel; for i:=0 to 255 do begin   myPanel[i]:=TPanel.Create(form1);   ... set its properties end; ... because FindComponent() is much slower and you don't have to manually draw them in the design, but have the exact properties mathematically right. ---------------------------------------------------------------------- m.vincent · 2011-09-26 16:39 Quote from: Arbee on September 26, 2011, 04:20:55 pmAlthough you're absolutely right Mike, I don't think a lot of people would call their comboboxes "panelxxx".  LOL - indeed. Mike