Graham

for i := 0 to Form.ComponentCount-1 do
  if Form.Components[i].InheritsFrom(TButton) then
TButton(Form.Components[i]).Enabled:=true;

HTH

Neven

----- Original Message -----
From: Graham Mayes <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Friday, 11 May 2001 10:41
Subject: [DUG]: basic question?


> I feel I must have missed something very elementary here:-
>
> A form has (say) 20 buttons named Button1, Button2 etc..
> If you want to do something with each button, at the moment I write
>    Button1.enabled:=true;
>    Button2.enabled:=true;
>    Button3.enabled:=true;
>    .
>    .
>    etc
>
> How can I refer to each button in a loop?
> eg
>   for button_number:=1 to 20...
>
> TAI
> Graham
>
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to