unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm2 = class(TForm)
Button1: TButton;
SpeedButton1: TSpeedButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Fsbtn1:TSpeedButton;
Fsbtn2:TSpeedButton;
procedure SbtnClick(sender:TObject);
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
Fsbtn1:=TSpeedButton.Create(Self);
Fsbtn1.SetBounds(10,10,200,20);
Fsbtn1.Caption := 'SpeedButton1';
Fsbtn1.OnClick := SbtnClick;
Fsbtn1.Parent := Self;
Fsbtn2:=TSpeedButton.Create(Self);
Fsbtn2.SetBounds(10,30,200,20);
Fsbtn2.Caption := 'SpeedButton2';
Fsbtn2.OnClick := SbtnClick;
Fsbtn2.Parent := Self;
end;
procedure TForm2.SbtnClick(sender: TObject);
begin
if sender = Fsbtn1 then
begin
Fsbtn2.Caption := Fsbtn2.Caption + '=#';
end
else
begin
Fsbtn1.Caption := Fsbtn1.Caption + '=%';
end;
end;
end.