2006/6/3, Vincent Snijders <[EMAIL PROTECTED]>:
Alexandre Leclerc wrote:
> It is [control-type/category][control-name] based. I also found that
> making automatic stuff is also clean... simple example I did once for
> other reasons (I write the code from memory, might not compile):
> for i := 0 to ControlCount-1 do
>  if Copy(Controls[i].Name, 1, 3) = 'lbl' then
>    (Controls[i] as TLabel).Caption := 'Label control' + IntToStr(i);
>

I would write that as
for i := 0 to ControlCount-1 do
   if Controls[i] is TLabel then
     TLabel(Controls[i]).Caption := 'Label control' + IntToStr(i);

Yes, I must say the example is plain wrong. Your code is much better
in this situation. (I cant' believe I wrote that - lol).

--
Alexandre Leclerc

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to