You can either iterate through the controls on the form using
MyForm.Controls and checking thier type or you can define a private TList
and push all your buttons into the list on create (or in the constructor)
and iterate through the TList.
========================================================
Luke Pascoe Delphi Programmer
enSynergy Consulting LTD
[EMAIL PROTECTED] +64-9-3551593 fax +64-9-3551590
Level 4, 10-12 Federal St, Auckland, New Zealand
PO Box 32521, Devonport, Auckland 1330, New Zealand
================== I.H.T.F.P. ==========================
> -----Original Message-----
> From: Graham Mayes [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 11 May 2001 10:42 a.m.
> To: Multiple recipients of list delphi
> 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"