B
bearyan
Unregistered / Unconfirmed
GUEST, unregistred user!
有以下程序,三个按键共用同一个程序段procedure TForm1.Button1Click(Sender: TObject);
begin
IF (Sender AS TButton).Caption = 'Button1' then
ShowMessage('Button1') else
IF (Sender AS TButton).Caption = 'Button2' then
ShowMessage('Button2') else
IF (Sender AS TButton).Caption = 'Button3' then
ShowMessage('Button3');
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
IF Edit1.Text = '1' then
Button1Click(Button1);
end;
现在我想输入1,就等于Button1按下(已经实现);但是输入2或3,想实现Button2或Button3按下该如何??
begin
IF (Sender AS TButton).Caption = 'Button1' then
ShowMessage('Button1') else
IF (Sender AS TButton).Caption = 'Button2' then
ShowMessage('Button2') else
IF (Sender AS TButton).Caption = 'Button3' then
ShowMessage('Button3');
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
IF Edit1.Text = '1' then
Button1Click(Button1);
end;
现在我想输入1,就等于Button1按下(已经实现);但是输入2或3,想实现Button2或Button3按下该如何??