'List Index out of bound(6)' with iterating through the components on a form.
Posted on 2007-03-21
The following code throws a 'List Index Out of bounds(6)' error. I am trying to change font for all the components on a form and any components within a component.(for example a form containing a pagecontrol which contains several tabsheets, which inturn contain several different components.)
What am I doing wrong?
procedure TSLCCOTForm.FormShow(Sender: TObject);
if PixelsPerInch <> 96 then
procedure TSLCCOTForm.Iterate(Contr: TWinControl);
i, DesiredSize : integer;
for i := 0 to Contr.ControlCount -1 do
DesiredSize := 8;
TFooClass(Controls[i]).Font.Name := 'Arial';
TFooClass(Controls[i]).Font.Size := MulDiv(DesiredSize,96,PixelsPerInch);
if Contr.Controls[i] is TWinControl then
Iterate(Contr.Controls[i] as TWinControl);