Files
lazarus-ccr/applications/lazstats/source/forms/simulations/fprobunit.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

88 lines
1.6 KiB
ObjectPascal

unit FProbUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls,
Functionslib;
type
{ TFForm }
TFForm = class(TForm)
Bevel1: TBevel;
CancelBtn: TButton;
ComputeBtn: TButton;
DF1Edit: TEdit;
DF2Edit: TEdit;
Panel1: TPanel;
ProbEdit: TEdit;
FEdit: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
ResetBtn: TButton;
ReturnBtn: TButton;
procedure ComputeBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
FForm: TFForm;
implementation
uses
Math;
{ TFForm }
procedure TFForm.ResetBtnClick(Sender: TObject);
begin
FEdit.Text := '';
DF1Edit.Text := '';
DF2Edit.Text := '';
ProbEdit.Text := '';
end;
procedure TFForm.ComputeBtnClick(Sender: TObject);
VAR
F, df1, df2, prob : extended;
outvalue : string;
begin
F := StrToFloat(FEdit.Text);
df1 := StrToFloat(DF1Edit.Text);
df2 := StrToFloat(DF2Edit.Text);
prob := probf(F,df1,df2);
outvalue := format('%6.4f',[prob]);
ProbEdit.Text := outvalue;
end;
procedure TFForm.FormActivate(Sender: TObject);
var
w: Integer;
begin
w := MaxValue([CancelBtn.Width, ResetBtn.Width, ReturnBtn.Width, ComputeBtn.Width]);
CancelBtn.Constraints.MinWidth := w;
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
ReturnBtn.Constraints.MinWidth := w;
end;
initialization
{$I fprobunit.lrs}
end.