Введение в программирование. Pascal и Delphi. Гурьянов Л.В - 174 стр.

UptoLike

173
BtnAdd: TButton;
PanelResult: TPanel;
BtnMinus: TButton;
BtnDivide: TButton;
BtnClear: TButton;
BtnClose: TButton;
BtnMult: TButton;
procedure BtnAddClick(Sender: TObject);
procedure BtnMinusClick(Sender: TObject);
procedure BtnDivideClick(Sender: TObject);
procedure BtnClearClick(Sender: TObject);
procedure BtnCloseClick(Sender: TObject);
procedure BtnMultClick(Sender: TObject);
procedure Operand1keyPress(Sender: TObject; var Key: Char);
procedure OnCalcActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
CalcForm: TCalcForm;
implementation
{$R *.DFM}
procedure TCalcForm.BtnAddClick(Sender: TObject);
begin
EditResult.Text:=
IntToStr(StrToInt(EditOperand1.Text)+
StrToInt(EditOperand2.Text));
OperatorLabel.Caption:='+';
ResultLabel.Caption :='=';
EditOperand1.SetFocus;
end;
  BtnAdd: TButton;
  PanelResult: TPanel;
  BtnMinus: TButton;
  BtnDivide: TButton;
  BtnClear: TButton;
  BtnClose: TButton;
  BtnMult: TButton;
  procedure BtnAddClick(Sender: TObject);
  procedure BtnMinusClick(Sender: TObject);
  procedure BtnDivideClick(Sender: TObject);
  procedure BtnClearClick(Sender: TObject);
  procedure BtnCloseClick(Sender: TObject);
  procedure BtnMultClick(Sender: TObject);
  procedure Operand1keyPress(Sender: TObject; var Key: Char);
  procedure OnCalcActivate(Sender: TObject);
 private
  { Private declarations }
 public
  { Public declarations }
 end;

var
 CalcForm: TCalcForm;

implementation

{$R *.DFM}

procedure TCalcForm.BtnAddClick(Sender: TObject);
begin
   EditResult.Text:=
   IntToStr(StrToInt(EditOperand1.Text)+
             StrToInt(EditOperand2.Text));
   OperatorLabel.Caption:='+';
   ResultLabel.Caption :='=';
   EditOperand1.SetFocus;
end;


                           173