Files
lazarus-ccr/applications/lazstats/source/forms/simulations/probzunit.pas
wp_xxyyzz 2f33dc9f7b LazStats: initial commit.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7345 8e941d3f-bd1b-0410-a28a-d453659cc2b4
2020-03-30 18:01:44 +00:00

79 lines
1.4 KiB
ObjectPascal

unit ProbZUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls,
FunctionsLib;
type
{ TProbzForm }
TProbzForm = class(TForm)
Bevel1: TBevel;
Panel1: TPanel;
ReturnBtn: TButton;
CancelBtn: TButton;
ResetBtn: TButton;
ComputeBtn: TButton;
ProbzEdit: TEdit;
Label2: TLabel;
zEdit: TEdit;
Label1: TLabel;
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
ProbzForm: TProbzForm;
implementation
uses
Math;
{ TProbzForm }
procedure TProbzForm.ResetBtnClick(Sender: TObject);
begin
zEdit.Text := '';
ProbzEdit.Text := '';
end;
procedure TProbzForm.ComputeBtnClick(Sender: TObject);
VAR
zprob, z : double;
outvalue : string;
begin
z := StrToFloat(zEdit.Text);
zprob := 1.0 - probz(z);
outvalue := format('%6.4f',[zprob]);
ProbzEdit.Text := outvalue;
end;
procedure TProbzForm.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;
initialization
{$I probzunit.lrs}
end.