You've already forked lazarus-ccr
LazStats: Refactor RelChangeUnit. Add its pdf to the chm file.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7445 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -1,12 +1,14 @@
|
||||
object RelChangeFrm: TRelChangeFrm
|
||||
Left = 855
|
||||
Height = 163
|
||||
Height = 190
|
||||
Top = 410
|
||||
Width = 400
|
||||
HelpType = htKeyword
|
||||
HelpKeyword = 'ReliabilityduetoTestVarianceChan.htm'
|
||||
AutoSize = True
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Variance Change Affect on Reliability'
|
||||
ClientHeight = 163
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Variance Change Effect on Reliability'
|
||||
ClientHeight = 190
|
||||
ClientWidth = 400
|
||||
OnActivate = FormActivate
|
||||
OnShow = FormShow
|
||||
@ -15,10 +17,10 @@ object RelChangeFrm: TRelChangeFrm
|
||||
object ResetBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = CancelBtn
|
||||
Left = 103
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
Left = 183
|
||||
Height = 25
|
||||
Top = 128
|
||||
Top = 148
|
||||
Width = 54
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -30,31 +32,13 @@ object RelChangeFrm: TRelChangeFrm
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 2
|
||||
end
|
||||
object CancelBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
Left = 169
|
||||
Height = 25
|
||||
Top = 128
|
||||
Width = 62
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ReturnBtn
|
||||
Left = 243
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
Left = 249
|
||||
Height = 25
|
||||
Top = 128
|
||||
Top = 148
|
||||
Width = 76
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -64,35 +48,35 @@ object RelChangeFrm: TRelChangeFrm
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 4
|
||||
TabOrder = 3
|
||||
end
|
||||
object ReturnBtn: TButton
|
||||
object CloseBtn: TButton
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 331
|
||||
Left = 337
|
||||
Height = 25
|
||||
Top = 128
|
||||
Width = 61
|
||||
Top = 148
|
||||
Width = 55
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Return'
|
||||
ModalResult = 1
|
||||
TabOrder = 5
|
||||
Caption = 'Close'
|
||||
ModalResult = 11
|
||||
TabOrder = 4
|
||||
end
|
||||
object HelpBtn: TButton
|
||||
Tag = 142
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
Left = 40
|
||||
Left = 120
|
||||
Height = 25
|
||||
Top = 128
|
||||
Top = 148
|
||||
Width = 51
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
@ -109,15 +93,16 @@ object RelChangeFrm: TRelChangeFrm
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 51
|
||||
Height = 104
|
||||
Height = 116
|
||||
Top = 8
|
||||
Width = 299
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Right = 16
|
||||
BorderSpacing.Bottom = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 104
|
||||
ClientHeight = 116
|
||||
ClientWidth = 299
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
@ -165,7 +150,7 @@ object RelChangeFrm: TRelChangeFrm
|
||||
AnchorSideRight.Control = NewRelEdit
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 85
|
||||
Top = 97
|
||||
Width = 218
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
@ -219,23 +204,35 @@ object RelChangeFrm: TRelChangeFrm
|
||||
end
|
||||
object NewRelEdit: TEdit
|
||||
AnchorSideLeft.Control = OldRelEdit
|
||||
AnchorSideTop.Control = NewVarEdit
|
||||
AnchorSideTop.Control = Bevel2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 226
|
||||
Height = 23
|
||||
Top = 81
|
||||
Top = 93
|
||||
Width = 73
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Top = 8
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 3
|
||||
Text = 'Edit1'
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = NewVarEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 77
|
||||
Width = 400
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -245,7 +242,7 @@ object RelChangeFrm: TRelChangeFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 112
|
||||
Top = 132
|
||||
Width = 400
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Shape = bsBottomLine
|
||||
|
@ -15,12 +15,12 @@ type
|
||||
|
||||
TRelChangeFrm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
Bevel2: TBevel;
|
||||
HelpBtn: TButton;
|
||||
Panel1: TPanel;
|
||||
ResetBtn: TButton;
|
||||
CancelBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
ReturnBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
OldRelEdit: TEdit;
|
||||
OldVarEdit: TEdit;
|
||||
NewVarEdit: TEdit;
|
||||
@ -66,12 +66,11 @@ begin
|
||||
if FAutoSized then
|
||||
exit;
|
||||
|
||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, CancelBtn.Width, ComputeBtn.Width, ReturnBtn.Width]);
|
||||
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
|
||||
HelpBtn.Constraints.MinWidth := w;
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
CancelBtn.Constraints.MinWidth := w;
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
ReturnBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
|
||||
Constraints.MinHeight := Height;
|
||||
Constraints.MaxHeight := Height;
|
||||
@ -93,13 +92,28 @@ end;
|
||||
|
||||
procedure TRelChangeFrm.ComputeBtnClick(Sender: TObject);
|
||||
var
|
||||
OldRel, NewRel, OldVar, NewVar : double;
|
||||
oldRel, newRel, oldVar, newVar: double;
|
||||
begin
|
||||
OldRel := StrToFloat(OldRelEdit.Text);
|
||||
OldVar := StrToFloat(OldVarEdit.Text);
|
||||
NewVar := StrToFloat(NewVarEdit.Text);
|
||||
NewRel := 1.0 - ((OldVar / NewVar) * (1.0 - OldRel));
|
||||
NewRelEdit.Text := FormatFloat('0.00000', NewRel); //FloatToStr(NewRel);
|
||||
if (OldRelEdit.Text = '') or not TryStrToFloat(OldRelEdit.Text, oldRel) then
|
||||
begin
|
||||
OldRelEdit.SetFocus;
|
||||
MessageDlg('Valid number required.', mtError, [mbOK], 0);
|
||||
exit;
|
||||
end;
|
||||
if (OldVarEdit.Text = '') or not TryStrToFloat(OldVarEdit.Text, oldVar) then
|
||||
begin
|
||||
OldVarEdit.SetFocus;
|
||||
MessageDlg('Valid number required.', mtError, [mbOK], 0);
|
||||
exit;
|
||||
end;
|
||||
if (NewVarEdit.Text = '') or not TryStrToFloat(NewVarEdit.Text, newVar) then
|
||||
begin
|
||||
NewVarEdit.SetFocus;
|
||||
MessageDlg('Valid number required.', mtError, [mbOK], 0);
|
||||
exit;
|
||||
end;
|
||||
newRel := 1.0 - (oldVar / newVar) * (1.0 - oldRel);
|
||||
NewRelEdit.Text := FormatFloat('0.00000', newRel);
|
||||
end;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user