You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8048 8e941d3f-bd1b-0410-a28a-d453659cc2b4
91 lines
1.7 KiB
ObjectPascal
91 lines
1.7 KiB
ObjectPascal
unit TwoZProbUnit;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
|
StdCtrls, ExtCtrls;
|
|
|
|
type
|
|
|
|
{ TTwozProbForm }
|
|
|
|
TTwozProbForm = class(TForm)
|
|
Bevel1: TBevel;
|
|
CancelBtn: TButton;
|
|
Panel1: TPanel;
|
|
ResetBtn: TButton;
|
|
ComputeBtn: TButton;
|
|
ReturnBtn: TButton;
|
|
ProbEdit: TEdit;
|
|
Label3: TLabel;
|
|
Z2Edit: TEdit;
|
|
Label2: TLabel;
|
|
Z1Edit: TEdit;
|
|
Label1: TLabel;
|
|
procedure ComputeBtnClick(Sender: TObject);
|
|
procedure FormActivate(Sender: TObject);
|
|
procedure ResetBtnClick(Sender: TObject);
|
|
private
|
|
{ private declarations }
|
|
public
|
|
{ public declarations }
|
|
end;
|
|
|
|
var
|
|
TwozProbForm: TTwozProbForm;
|
|
|
|
implementation
|
|
|
|
{$R *.lfm}
|
|
|
|
uses
|
|
Math, MathUnit, Utils;
|
|
|
|
{ TTwozProbForm }
|
|
|
|
procedure TTwozProbForm.ResetBtnClick(Sender: TObject);
|
|
begin
|
|
ProbEdit.Text := '';
|
|
Z1Edit.Text := '';
|
|
Z2Edit.Text := '';
|
|
end;
|
|
|
|
procedure TTwozProbForm.ComputeBtnClick(Sender: TObject);
|
|
var
|
|
z1, z2, prob : double;
|
|
begin
|
|
if not MyTryStrToFloat(Z1Edit.Text, z1) then
|
|
begin
|
|
Z1Edit.SetFocus;
|
|
ErrorMsg('No valid number.');
|
|
exit;
|
|
end;
|
|
|
|
if not MyTryStrToFloat(Z2Edit.Text, z2) then
|
|
begin
|
|
Z2Edit.SetFocus;
|
|
ErrorMsg('No valid number.');
|
|
exit;
|
|
end;
|
|
|
|
prob := abs(NormalDist(z2) - NormalDist(z1));
|
|
ProbEdit.Text := Format('%6.4f', [prob]);
|
|
end;
|
|
|
|
procedure TTwozProbForm.FormActivate(Sender: TObject);
|
|
var
|
|
w: Integer;
|
|
begin
|
|
w := MaxValue([CancelBtn.Width, ResetBtn.Width, ComputeBtn.Width, ReturnBtn.Width]);
|
|
CancelBtn.Constraints.MinWidth := w;
|
|
ResetBtn.Constraints.MinWidth := w;
|
|
ComputeBtn.Constraints.MinWidth := w;
|
|
ReturnBtn.Constraints.MinWidth := w;
|
|
end;
|
|
|
|
end.
|
|
|