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

UptoLike

175
procedure TCalcForm.BtnMultClick(Sender: TObject);
begin
EditResult.Text:=
IntToStr(StrToInt(EditOperand1.Text)*
StrToInt(EditOperand2.Text));
OperatorLabel.Caption:='*';
ResultLabel.Caption :='=';
EditOperand1.SetFocus;
end;
procedure TCalcForm.Operand1keyPress(Sender: TObject; var
Key: Char);
begin
case Key of
'0'..'9', '-', chr(8): ;
chr(13) : EditOperand2.SetFocus;
else
key:=chr(0);
end;
end;
procedure TCalcForm.OnCalcActivate(Sender: TObject);
begin
EditOperand1.Text :='' ;
EditOperand2.Text :='' ;
EditResult.Text :='' ;
OperatorLabel.Caption:='?';
ResultLabel.Caption :='?';
EditOperand1.SetFocus;
end;
end.
  procedure TCalcForm.BtnMultClick(Sender: TObject);
  begin
     EditResult.Text:=
     IntToStr(StrToInt(EditOperand1.Text)*
               StrToInt(EditOperand2.Text));
     OperatorLabel.Caption:='*';
     ResultLabel.Caption :='=';
     EditOperand1.SetFocus;
  end;

  procedure TCalcForm.Operand1keyPress(Sender: TObject; var
Key: Char);
  begin
    case Key of
       '0'..'9', '-', chr(8): ;
       chr(13)              : EditOperand2.SetFocus;
    else
       key:=chr(0);
    end;
  end;
  procedure TCalcForm.OnCalcActivate(Sender: TObject);
  begin
      EditOperand1.Text :='' ;
      EditOperand2.Text :='' ;
      EditResult.Text           :='' ;
      OperatorLabel.Caption:='?';
      ResultLabel.Caption :='?';
      EditOperand1.SetFocus;
  end;

  end.




                             175