{ Not this. }
procedure TToolbar.SpeedButton0Click(Sender: TObject);
begin
SpeedButtonAction(0);
end;
{ More like this. }
procedure TToolbar.AnySpeedButtonClick(Sender:TObject, ButtonNo:byte);
begin
SpeedButtonAction(ButtonNo);
end;
A: Set all the OnClick events to point to the following method, and assign the appropiate value to the Tag properties of the SpeedButtons.
procedure TForm1.AnySpeedButtonClick(Sender:TObject)
begin
SpeedButtonAction((Sender as TSpeedButton).Tag);
end;
Note: If your speed buttons do indeed have names SpeedButton1, SpeedButton2, etc., you can use the form's FindComponent method to pretend they're an array:
FOR N := 1 TO NumButtons DO
WITH FindComponent('SpeedButton'+Str(N)) AS TSpeedButton DO
{ whatever } ;