You've already forked lazarus-ccr
76 lines
1.4 KiB
ObjectPascal
76 lines
1.4 KiB
ObjectPascal
![]() |
unit SpBrUnit;
|
||
|
|
||
|
{$mode objfpc}{$H+}
|
||
|
|
||
|
interface
|
||
|
|
||
|
uses
|
||
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||
|
StdCtrls, contexthelpunit;
|
||
|
|
||
|
type
|
||
|
|
||
|
{ TSpBrFrm }
|
||
|
|
||
|
TSpBrFrm = class(TForm)
|
||
|
HelpBtn: TButton;
|
||
|
ResetBtn: TButton;
|
||
|
CancelBtn: TButton;
|
||
|
ComputeBtn: TButton;
|
||
|
ReturnBtn: TButton;
|
||
|
OldRelEdit: TEdit;
|
||
|
MultKEdit: TEdit;
|
||
|
NewRelEdit: TEdit;
|
||
|
Label1: TLabel;
|
||
|
Label2: TLabel;
|
||
|
Label3: TLabel;
|
||
|
procedure ComputeBtnClick(Sender: TObject);
|
||
|
procedure FormShow(Sender: TObject);
|
||
|
procedure HelpBtnClick(Sender: TObject);
|
||
|
procedure ResetBtnClick(Sender: TObject);
|
||
|
private
|
||
|
{ private declarations }
|
||
|
public
|
||
|
{ public declarations }
|
||
|
end;
|
||
|
|
||
|
var
|
||
|
SpBrFrm: TSpBrFrm;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
{ TSpBrFrm }
|
||
|
|
||
|
procedure TSpBrFrm.ResetBtnClick(Sender: TObject);
|
||
|
begin
|
||
|
OldRelEdit.Text := '';
|
||
|
NewRelEdit.Text := '';
|
||
|
MultKEdit.Text := '';
|
||
|
end;
|
||
|
|
||
|
procedure TSpBrFrm.FormShow(Sender: TObject);
|
||
|
begin
|
||
|
ResetBtnClick(self);
|
||
|
end;
|
||
|
|
||
|
procedure TSpBrFrm.HelpBtnClick(Sender: TObject);
|
||
|
begin
|
||
|
ContextHelpForm.HelpMessage((Sender as TButton).tag);
|
||
|
end;
|
||
|
|
||
|
procedure TSpBrFrm.ComputeBtnClick(Sender: TObject);
|
||
|
var
|
||
|
oldrel, newrel, Factor : double;
|
||
|
begin
|
||
|
oldrel := StrToFloat(OldRelEdit.Text);
|
||
|
Factor := StrToFloat(MultKEdit.Text);
|
||
|
newrel := (Factor * oldrel) / (1.0 + (Factor - 1.0) * oldrel);
|
||
|
NewRelEdit.Text := FloatToStr(newrel);
|
||
|
end;
|
||
|
|
||
|
initialization
|
||
|
{$I spbrunit.lrs}
|
||
|
|
||
|
end.
|
||
|
|