Here is how I handle dynamically created buttons :

Create a TStringList object, and add each of the buttons to it using
AddObject method.

Then you can pass the index of the StringList to a function, ie

procedure BoldButton( Index : Integer );
var
        TheButton : TButton;
begin
        TheButton := TButton( TheExternalStringList.Objects[ Index ] );
        TheButton.Font.Style := fsBold;
end;

Remember to destroy the stringlist when youre finished with it - in the Form
Destroy for example.    

-----Original Message-----
From: Alistair George [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 30, 1999 08:55 AM
To: Multiple recipients of list delphi
Subject: [DUG]: sending component references


Morning all.
I want to pick up a component reference from a sent value, but dont want to
re-write my code to do it.
I guess the normal way would be to:
Txform.alterbuttonstate(sender:tobject);
begin
with sender as tbutton do
begin
font.style:=fsbold;
end;
end;

What I would like to do is:
Txform.alterbuttonstate(value:word);
begin
button[value].font.style:=fsbold; //invalid of course
end;

Any way to do this?
Cheers,
Al+

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to