LazStats: All SPC forms updated to new form inheritance.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7766 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-11 10:19:27 +00:00
parent 8897b1c219
commit b33f2006fc
11 changed files with 439 additions and 338 deletions

View File

@ -5,78 +5,100 @@ inherited CChartForm: TCChartForm
Caption = 'Defects C Chart' Caption = 'Defects C Chart'
ClientHeight = 420 ClientHeight = 420
inherited ParamsPanel: TPanel inherited ParamsPanel: TPanel
Height = 420 Height = 404
Width = 440 Width = 451
ClientHeight = 420 ClientHeight = 404
ClientWidth = 440 ClientWidth = 451
inherited CloseBtn: TButton
Left = 396
Top = 379
end
inherited ComputeBtn: TButton
Left = 312
Top = 379
end
inherited ResetBtn: TButton
Left = 250
Top = 379
end
inherited HelpBtn: TButton
Left = 191
Top = 379
TabOrder = 7
end
inherited ButtonBevel: TBevel
Top = 363
Width = 451
end
inherited VarList: TListBox inherited VarList: TListBox
Height = 345 Height = 338
Width = 200 Width = 204
end end
inherited GroupLabel: TLabel inherited GroupLabel: TLabel
Left = 240 Left = 246
Top = 274 Top = 237
Visible = False Visible = False
end end
inherited GroupEdit: TEdit inherited GroupEdit: TEdit
Left = 240 Left = 246
Top = 291 Top = 254
Width = 200 Width = 205
TabOrder = 3 TabOrder = 3
Visible = False Visible = False
end end
inherited MeasLabel: TLabel inherited MeasLabel: TLabel
Left = 240 Left = 246
end end
inherited MeasEdit: TEdit inherited MeasEdit: TEdit
Left = 240 Left = 246
Width = 200 Width = 205
end end
inherited Bevel2: TBevel inherited Bevel2: TBevel
Left = 209 Left = 214
end end
inherited MeasInBtn: TSpeedButton inherited MeasInBtn: TSpeedButton
Left = 208 Left = 212
end end
inherited MeasOutBtn: TSpeedButton inherited MeasOutBtn: TSpeedButton
Left = 209 Left = 212
end end
inherited GroupInBtn: TSpeedButton inherited GroupInBtn: TSpeedButton
Left = 208 AnchorSideTop.Control = SigmaOptns
Top = 272 Left = 212
Anchors = [akLeft] Top = 235
BorderSpacing.Top = 24
Visible = False Visible = False
end end
inherited GroupOutBtn: TSpeedButton inherited GroupOutBtn: TSpeedButton
Left = 209 Left = 212
Top = 300 Top = 265
Visible = False Visible = False
end end
object SigmaOptns: TRadioGroup[12] object SigmaOptns: TRadioGroup[16]
AnchorSideLeft.Control = MeasEdit AnchorSideLeft.Control = MeasInBtn
AnchorSideTop.Control = MeasEdit AnchorSideTop.Control = MeasOutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 240 Left = 212
Height = 128 Height = 114
Top = 99 Top = 97
Width = 200 Width = 171
Anchors = [akTop, akLeft, akRight]
AutoFill = True AutoFill = True
BorderSpacing.Top = 32 AutoSize = True
BorderSpacing.Top = 24
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Sigma Units for UCL and LCL' Caption = 'Sigma Units for UCL and LCL'
ChildSizing.LeftRightSpacing = 12 ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6 ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
ClientHeight = 108 ClientHeight = 94
ClientWidth = 196 ClientWidth = 167
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'3 Sigma' '3 Sigma'
@ -89,15 +111,25 @@ inherited CChartForm: TCChartForm
AnchorSideRight.Control = SigmaOptns AnchorSideRight.Control = SigmaOptns
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 128 Left = 132
Height = 23 Height = 23
Top = 80 Top = 66
Width = 56 Width = 36
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
Constraints.MinWidth = 36
TabOrder = 0 TabOrder = 0
Text = 'XSigmaEdit' Text = 'XSigmaEdit'
end end
end end
end end
inherited ParamsSplitter: TSplitter
Left = 463
Height = 420
end
inherited PageControl: TPageControl
Left = 472
Height = 404
Width = 447
end
end end

View File

@ -15,8 +15,8 @@ type
TCChartForm = class(TBasicSPCForm) TCChartForm = class(TBasicSPCForm)
SigmaOptns: TRadioGroup; SigmaOptns: TRadioGroup;
XSigmaEdit: TEdit; XSigmaEdit: TEdit;
procedure FormActivate(Sender: TObject);
protected protected
procedure AdjustConstraints; override;
procedure Compute; override; procedure Compute; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override; function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
@ -38,6 +38,30 @@ uses
{ TCChartForm } { TCChartForm }
procedure TCChartForm.AdjustConstraints;
var
y: Integer;
begin
inherited;
ParamsPanel.Constraints.MinWidth := Max(
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
SigmaOptns.Width*2 - MeasInBtn.Width
);
if GroupOutBtn.Visible then
y := GroupOutBtn.Top + GroupOutBtn.Height
else
y := SigmaOptns.Top + SigmaOptns.Height;
ParamsPanel.Constraints.MinHeight := y +
VarList.BorderSpacing.Bottom + ButtonBevel.Height +
CloseBtn.BorderSpacing.Top + CloseBtn.Height;
SigmaOptns.Anchors := SigmaOptns.Anchors + [akRight];
SigmaOptns.AnchorSideRight.Control := ParamsPanel;
end;
procedure TCChartForm.Compute; procedure TCChartForm.Compute;
var var
i: Integer; i: Integer;
@ -108,39 +132,6 @@ begin
); );
end; end;
procedure TCChartForm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
HelpBtn.Constraints.MinWidth := w;
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
DisableAutoSizing;
try
SigmaOptns.AnchorSideRight.Control := nil;
VarList.Constraints.MinWidth := VarListLabel.Width;
ParamsPanel.Constraints.MinWidth := Max(
CloseBtn.Left + CloseBtn.Width - HelpBtn.Left + HelpBtn.BorderSpacing.Around,
SigmaOptns.Width * 2 + VarList.BorderSpacing.Right + VarList.BorderSpacing.Left
);
// Constraints.MinHeight := SigmaOptns.Top + SigmaOptns.Height + SigmaOptns.BorderSpacing.Bottom + ButtonPanel.Height;
SigmaOptns.AnchorSideRight.Control := MeasEdit;
SigmaOptns.AnchorSideRight.Side := asrBottom;
finally
EnableAutoSizing;
end;
Position := poDesigned;
FAutoSized := true;
end;
procedure TCChartForm.Reset; procedure TCChartForm.Reset;
begin begin

View File

@ -8,66 +8,87 @@ inherited CUSUMChartForm: TCUSUMChartForm
ClientWidth = 1000 ClientWidth = 1000
ShowHint = True ShowHint = True
inherited ParamsPanel: TPanel inherited ParamsPanel: TPanel
Height = 503 Height = 487
Width = 432 Width = 441
ClientHeight = 503 ClientHeight = 487
ClientWidth = 432 ClientWidth = 441
inherited CloseBtn: TButton
Left = 386
Top = 462
TabOrder = 8
end
inherited ComputeBtn: TButton
Left = 302
Top = 462
end
inherited ResetBtn: TButton
Left = 240
Top = 462
end
inherited HelpBtn: TButton
Left = 181
Top = 462
TabOrder = 7
end
inherited ButtonBevel: TBevel
Top = 446
Width = 441
end
inherited VarList: TListBox inherited VarList: TListBox
Height = 428 Height = 421
Width = 196 Width = 199
end end
inherited GroupLabel: TLabel inherited GroupLabel: TLabel
Left = 236 Left = 241
end end
inherited GroupEdit: TEdit inherited GroupEdit: TEdit
Left = 236 Left = 241
Width = 196 Width = 200
end end
inherited MeasLabel: TLabel inherited MeasLabel: TLabel
Left = 236 Left = 241
end end
inherited MeasEdit: TEdit inherited MeasEdit: TEdit
Left = 236 Left = 241
Width = 196 Width = 200
end end
inherited Bevel2: TBevel inherited Bevel2: TBevel
Left = 205 Left = 209
end end
inherited MeasInBtn: TSpeedButton inherited MeasInBtn: TSpeedButton
Left = 204 Left = 207
end end
inherited MeasOutBtn: TSpeedButton inherited MeasOutBtn: TSpeedButton
Left = 205 Left = 207
end end
inherited GroupInBtn: TSpeedButton inherited GroupInBtn: TSpeedButton
AnchorSideLeft.Control = MeasInBtn AnchorSideLeft.Control = MeasInBtn
AnchorSideLeft.Side = asrTop AnchorSideLeft.Side = asrTop
Left = 204 Left = 207
end end
inherited GroupOutBtn: TSpeedButton inherited GroupOutBtn: TSpeedButton
AnchorSideLeft.Control = GroupInBtn AnchorSideLeft.Control = GroupInBtn
Left = 205 Left = 207
end end
object GroupBox2: TGroupBox[12] object OptionsGroup: TGroupBox[16]
AnchorSideLeft.Control = MeasInBtn AnchorSideLeft.Control = MeasInBtn
AnchorSideTop.Control = GroupEdit AnchorSideTop.Control = GroupEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = MeasEdit AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 204 Left = 207
Height = 134 Height = 134
Top = 153 Top = 151
Width = 228 Width = 234
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 20 BorderSpacing.Top = 20
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Options:' Caption = 'Options:'
ClientHeight = 114 ClientHeight = 114
ClientWidth = 224 ClientWidth = 230
TabOrder = 3 TabOrder = 3
object TargetChk: TCheckBox object TargetChk: TCheckBox
AnchorSideLeft.Control = GroupBox2 AnchorSideLeft.Control = OptionsGroup
AnchorSideTop.Control = TargetEdit AnchorSideTop.Control = TargetEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 12 Left = 12
@ -81,18 +102,17 @@ inherited CUSUMChartForm: TCUSUMChartForm
end end
object TargetEdit: TEdit object TargetEdit: TEdit
AnchorSideLeft.Control = StdDevEdit AnchorSideLeft.Control = StdDevEdit
AnchorSideTop.Control = GroupBox2 AnchorSideTop.Control = OptionsGroup
AnchorSideRight.Control = GroupBox2 AnchorSideRight.Control = OptionsGroup
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 132
Height = 23 Height = 23
Top = 0 Top = 0
Width = 84 Width = 90
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Constraints.MinWidth = 64
TabOrder = 1 TabOrder = 1
Text = 'TargetEdit' Text = 'TargetEdit'
end end
@ -112,15 +132,15 @@ inherited CUSUMChartForm: TCUSUMChartForm
TabStop = True TabStop = True
end end
object Bevel3: TBevel object Bevel3: TBevel
AnchorSideLeft.Control = GroupBox2 AnchorSideLeft.Control = OptionsGroup
AnchorSideTop.Control = StdDevEdit AnchorSideTop.Control = StdDevEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GroupBox2 AnchorSideRight.Control = OptionsGroup
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 8 Left = 8
Height = 4 Height = 4
Top = 58 Top = 58
Width = 208 Width = 214
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 8 BorderSpacing.Top = 8
@ -142,7 +162,7 @@ inherited CUSUMChartForm: TCUSUMChartForm
TabOrder = 5 TabOrder = 5
end end
object StdDevChk: TCheckBox object StdDevChk: TCheckBox
AnchorSideLeft.Control = GroupBox2 AnchorSideLeft.Control = OptionsGroup
AnchorSideTop.Control = StdDevEdit AnchorSideTop.Control = StdDevEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 12 Left = 12
@ -159,33 +179,32 @@ inherited CUSUMChartForm: TCUSUMChartForm
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = TargetEdit AnchorSideTop.Control = TargetEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GroupBox2 AnchorSideRight.Control = OptionsGroup
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 132
Height = 23 Height = 23
Top = 27 Top = 27
Width = 84 Width = 90
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 4 BorderSpacing.Bottom = 4
Constraints.MinWidth = 64
TabOrder = 3 TabOrder = 3
Text = 'StdDevEdit' Text = 'StdDevEdit'
end end
end end
object Notebook: TNotebook[13] object Notebook: TNotebook[17]
AnchorSideLeft.Control = GroupBox2 AnchorSideLeft.Control = MeasInBtn
AnchorSideTop.Control = GroupBox2 AnchorSideTop.Control = OptionsGroup
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = GroupBox2 AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 204 Left = 207
Height = 153 Height = 153
Top = 295 Top = 293
Width = 228 Width = 234
PageIndex = 0 PageIndex = 1
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
TabOrder = 4 TabOrder = 4
@ -198,12 +217,12 @@ inherited CUSUMChartForm: TCUSUMChartForm
Left = 0 Left = 0
Height = 80 Height = 80
Top = 0 Top = 0
Width = 228 Width = 193
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
Caption = 'Tabulated CUSUM Parameters' Caption = 'Tabulated CUSUM Parameters'
ClientHeight = 60 ClientHeight = 60
ClientWidth = 224 ClientWidth = 189
TabOrder = 0 TabOrder = 0
object Label7: TLabel object Label7: TLabel
AnchorSideTop.Control = kEdit AnchorSideTop.Control = kEdit
@ -225,7 +244,7 @@ inherited CUSUMChartForm: TCUSUMChartForm
Height = 23 Height = 23
Hint = 'Detection level for a shift in the process mean, '#13#10'expressed in data units (default), or'#13#10'as a multiple of the standard deviation of the '#13#10'data points (when "Normalized CUSUM" is checked).' Hint = 'Detection level for a shift in the process mean, '#13#10'expressed in data units (default), or'#13#10'as a multiple of the standard deviation of the '#13#10'data points (when "Normalized CUSUM" is checked).'
Top = 2 Top = 2
Width = 99 Width = 64
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -245,7 +264,7 @@ inherited CUSUMChartForm: TCUSUMChartForm
Height = 23 Height = 23
Hint = 'Probability of concluding that a shift in the process has occurred, when in fact it did not. ' Hint = 'Probability of concluding that a shift in the process has occurred, when in fact it did not. '
Top = 29 Top = 29
Width = 99 Width = 64
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
@ -278,12 +297,12 @@ inherited CUSUMChartForm: TCUSUMChartForm
Left = 0 Left = 0
Height = 153 Height = 153
Top = 0 Top = 0
Width = 228 Width = 234
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
Caption = 'V-Mask Specifications' Caption = 'V-Mask Specifications'
ClientHeight = 133 ClientHeight = 133
ClientWidth = 224 ClientWidth = 230
TabOrder = 0 TabOrder = 0
object Label4: TLabel object Label4: TLabel
AnchorSideLeft.Control = VMaskGroup AnchorSideLeft.Control = VMaskGroup
@ -330,7 +349,7 @@ inherited CUSUMChartForm: TCUSUMChartForm
Height = 23 Height = 23
Hint = 'Detection level for a shift in the process mean, '#13#10'expressed in data units (default), or'#13#10'as a multiple of the standard deviation of the '#13#10'data points (when "Normalized CUSUM" is checked).' Hint = 'Detection level for a shift in the process mean, '#13#10'expressed in data units (default), or'#13#10'as a multiple of the standard deviation of the '#13#10'data points (when "Normalized CUSUM" is checked).'
Top = 2 Top = 2
Width = 102 Width = 108
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
@ -350,7 +369,7 @@ inherited CUSUMChartForm: TCUSUMChartForm
Height = 23 Height = 23
Hint = 'Probability of concluding that a shift in the process has occurred, when in fact it did not. ' Hint = 'Probability of concluding that a shift in the process has occurred, when in fact it did not. '
Top = 29 Top = 29
Width = 102 Width = 108
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
@ -370,7 +389,7 @@ inherited CUSUMChartForm: TCUSUMChartForm
Height = 23 Height = 23
Hint = 'Probability of not detecting that a shift in the process mean has, in fact, occurred' Hint = 'Probability of not detecting that a shift in the process mean has, in fact, occurred'
Top = 56 Top = 56
Width = 102 Width = 108
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
@ -381,22 +400,23 @@ inherited CUSUMChartForm: TCUSUMChartForm
Text = 'BetaEdit' Text = 'BetaEdit'
end end
object VMaskScrollbar: TScrollBar object VMaskScrollbar: TScrollBar
AnchorSideLeft.Control = Label1 AnchorSideLeft.Control = VMaskPositionLabel
AnchorSideTop.Control = Label1 AnchorSideTop.Control = VMaskPositionLabel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = BetaEdit AnchorSideRight.Control = BetaEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 12 Left = 12
Height = 17 Height = 17
Top = 104 Top = 104
Width = 204 Width = 210
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
PageSize = 0 PageSize = 0
TabOrder = 3 TabOrder = 3
OnChange = VMaskScrollbarChange
end end
object Label1: TLabel object VMaskPositionLabel: TLabel
AnchorSideLeft.Control = Label4 AnchorSideLeft.Control = Label4
AnchorSideTop.Control = BetaEdit AnchorSideTop.Control = BetaEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
@ -411,4 +431,13 @@ inherited CUSUMChartForm: TCUSUMChartForm
end end
end end
end end
inherited ParamsSplitter: TSplitter
Left = 453
Height = 503
end
inherited PageControl: TPageControl
Left = 462
Height = 487
Width = 530
end
end end

View File

@ -19,7 +19,7 @@ type
Bevel3: TBevel; Bevel3: TBevel;
kEdit: TEdit; kEdit: TEdit;
TabularGroup: TGroupBox; TabularGroup: TGroupBox;
Label1: TLabel; VMaskPositionLabel: TLabel;
Label7: TLabel; Label7: TLabel;
Label8: TLabel; Label8: TLabel;
Notebook: TNotebook; Notebook: TNotebook;
@ -32,23 +32,29 @@ type
VMaskScrollbar: TScrollBar; VMaskScrollbar: TScrollBar;
DeltaEdit: TEdit; DeltaEdit: TEdit;
VMaskGroup: TGroupBox; VMaskGroup: TGroupBox;
GroupBox2: TGroupBox; OptionsGroup: TGroupBox;
Label4: TLabel; Label4: TLabel;
Label5: TLabel; Label5: TLabel;
Label6: TLabel; Label6: TLabel;
TargetChk: TCheckBox; TargetChk: TCheckBox;
TargetEdit: TEdit; TargetEdit: TEdit;
procedure FormActivate(Sender: TObject);
procedure rbTabularChange(Sender: TObject); procedure rbTabularChange(Sender: TObject);
procedure VMaskScrollbarChange(Sender: TObject);
private private
CUSums, CUSumsUpper, CUSumsLower: DblDyneVec; CUSums, CUSumsUpper, CUSumsLower: DblDyneVec;
SEMean: Double; SEMean: Double;
k, h: Double; k, h: Double;
protected protected
procedure AdjustConstraints; override;
procedure Compute; override; procedure Compute; override;
procedure PlotMeans(ATitle, AXTitle, AYTitle, ADataTitle, AGrandMeanTitle: String; procedure PlotMeans(ATitle, AXTitle, AYTitle, ADataTitle, AGrandMeanTitle: String;
const Groups: StrDyneVec; const {%H-}Means: DblDyneVec; const Groups: StrDyneVec; const {%H-}Means: DblDyneVec;
UCL, LCL, GrandMean, TargetSpec, LowerSpec, UpperSpec: double); override; UCL, LCL, GrandMean, TargetSpec, LowerSpec, UpperSpec: double); override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override; function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
public public
@ -67,8 +73,25 @@ uses
Math, TAChartUtils, TATypes, TASeries, Math, TAChartUtils, TATypes, TASeries,
Utils, MainUnit, ChartFrameUnit, DataProcs; Utils, MainUnit, ChartFrameUnit, DataProcs;
const
VMASK_POSITION_LABEL = 'Position of V-Mask: %s';
DEFAULT_VMASK_SCROLLBAR_MAX = 10000;
{ TCUSUMChartForm } { TCUSUMChartForm }
procedure TCUSUMChartForm.AdjustConstraints;
begin
Notebook.Constraints.MinWidth := Max(TabularGroup.Width, VMaskGroup.Width);
Notebook.Constraints.MinHeight := VMaskGroup.Height;
ParamsPanel.Constraints.MinWidth := Notebook.Constraints.MinWidth * 2 - MeasInBtn.Width;
ParamsPanel.Constraints.MinHeight := Notebook.Top + Notebook.Constraints.MinHeight +
VarList.BorderSpacing.Bottom + ButtonBevel.Height +
CloseBtn.Height + CloseBtn.BorderSpacing.Top;
end;
procedure TCUSUMChartForm.Compute; procedure TCUSUMChartForm.Compute;
var var
i, j, grpIndex, numGrps, grpSize, oldGrpSize, numValues: Integer; i, j, grpIndex, numGrps, grpSize, oldGrpSize, numValues: Integer;
@ -82,7 +105,6 @@ var
groups: StrDyneVec = nil; groups: StrDyneVec = nil;
means: DblDyneVec = nil; means: DblDyneVec = nil;
stdDevs: DblDyneVec = nil; stdDevs: DblDyneVec = nil;
// count: Integer; //: IntDyneVec = nil;
ColNoSelected: IntDyneVec = nil; ColNoSelected: IntDyneVec = nil;
lReport: TStrings; lReport: TStrings;
@ -262,9 +284,9 @@ begin
CUSums[j] := CUSums[j-1] + diff; CUSums[j] := CUSums[j-1] + diff;
if rbTabular.Checked then if rbTabular.Checked then
begin begin
CUSumsUpper[j] := Max(0, diff - k + CUSumsUpper[j-1]); CUSumsUpper[j] := Max(0, diff + CUSumsUpper[j-1] - k);
CUSumsLower[j] := Min(0, diff + k + CUSumsLower[j-1]); CUSumsLower[j] := Min(0, diff + CUSumsLower[j-1] + k);
// wp: There's a lot of garbage in the internet on these formulas! // wp: There's a lot of garbage in the internet about these formulas!
end; end;
end; end;
@ -348,44 +370,6 @@ begin
end; end;
procedure TCUSUMChartForm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
HelpBtn.Constraints.MinWidth := w;
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
DisableAutoSizing;
try
// VMaskGroup.Anchors := VMaskGroup.Anchors - [akRight];
VarList.Constraints.MinWidth := VarListLabel.Width;
ParamsPanel.Constraints.MinWidth := Max(
CloseBtn.Left + CloseBtn.Width - HelpBtn.Left + HelpBtn.BorderSpacing.Around,
GroupBox2.Width * 2 + VarList.BorderSpacing.Right + VarList.BorderSpacing.Left
);
TabularGroup.Constraints.MinHeight := VMaskScrollbar.Top + VMaskScrollbar.Height +
VMaskScrollbar.BorderSpacing.Bottom + TabularGroup.Height - TabularGroup.ClientHeight;
Notebook.Constraints.MinHeight := TabularGroup.Constraints.MinHeight;
Notebook.Height := 1; // Enforce notebook autosizing
// Constraints.MinHeight := Notebook.Top + Notebook.Height + Notebook.BorderSpacing.Bottom + ButtonPanel.Height;
if Height < Constraints.MinHeight then
Height := 1; // enforce height autosizing
// VMaskGroup.Anchors := VMaskGroup.Anchors + [akRight];
finally
EnableAutoSizing;
end;
Position := poDesigned;
FAutoSized := true;
end;
procedure TCUSUMChartForm.rbTabularChange(Sender: TObject); procedure TCUSUMChartForm.rbTabularChange(Sender: TObject);
begin begin
if (Sender = rbTabular) and rbTabular.Checked then if (Sender = rbTabular) and rbTabular.Checked then
@ -464,7 +448,7 @@ begin
AlphaEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL); AlphaEdit.Text := FormatFloat('0.00', DEFAULT_ALPHA_LEVEL);
BetaEdit.Text := FormatFloat('0.00', DEFAULT_BETA_LEVEL); BetaEdit.Text := FormatFloat('0.00', DEFAULT_BETA_LEVEL);
VMaskScrollbar.Min := 2; VMaskScrollbar.Min := 2;
VMaskScrollbar.Max := 1000; VMaskScrollbar.Max := DEFAULT_VMASK_SCROLLBAR_MAX;
VMaskScrollbar.Position := VMaskScrollbar.Max; VMaskScrollbar.Position := VMaskScrollbar.Max;
end; end;
@ -585,5 +569,18 @@ begin
Result := true; Result := true;
end; end;
procedure TCUSUMChartForm.VMaskScrollbarChange(Sender: TObject);
var
s: String;
begin
if VMaskScrollbar.Max = DEFAULT_VMASK_SCROLLBAR_MAX then
s := '-'
else
s := IntToStr(VMaskScrollbar.Position);
VMaskPositionLabel.Caption := Format(VMASK_POSITION_LABEL, [s]);
end;
end. end.

View File

@ -1,76 +1,104 @@
inherited PChartForm: TPChartForm inherited PChartForm: TPChartForm
Left = 556 Left = 556
Height = 428
Top = 220 Top = 220
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/PControlChart.htm' HelpKeyword = 'html/PControlChart.htm'
Caption = 'P Control Chart' Caption = 'P Control Chart'
ClientHeight = 428
inherited ParamsPanel: TPanel inherited ParamsPanel: TPanel
Width = 456 Height = 412
ClientWidth = 456 Width = 352
ClientHeight = 412
ClientWidth = 352
inherited CloseBtn: TButton
Left = 297
Top = 387
TabOrder = 8
end
inherited ComputeBtn: TButton
Left = 213
Top = 387
TabOrder = 9
end
inherited ResetBtn: TButton
Left = 151
Top = 387
end
inherited HelpBtn: TButton
Left = 92
Top = 387
TabOrder = 7
end
inherited ButtonBevel: TBevel
Top = 371
Width = 352
end
inherited VarList: TListBox inherited VarList: TListBox
Width = 208 Height = 346
Width = 155
end end
inherited GroupLabel: TLabel inherited GroupLabel: TLabel
Left = 248 Left = 197
Top = 328 Top = 293
Visible = False Visible = False
end end
inherited GroupEdit: TEdit inherited GroupEdit: TEdit
Left = 248 Left = 197
Top = 345 Top = 310
Width = 208 Width = 155
TabOrder = 5 TabOrder = 5
Visible = False Visible = False
end end
inherited MeasLabel: TLabel inherited MeasLabel: TLabel
Left = 248 Left = 197
end end
inherited MeasEdit: TEdit inherited MeasEdit: TEdit
Left = 248 Left = 197
Width = 208 Width = 155
end end
inherited Bevel2: TBevel inherited Bevel2: TBevel
Left = 217 Left = 165
end end
inherited MeasInBtn: TSpeedButton inherited MeasInBtn: TSpeedButton
Left = 216 Left = 163
end end
inherited MeasOutBtn: TSpeedButton inherited MeasOutBtn: TSpeedButton
Left = 217 Left = 163
end end
inherited GroupInBtn: TSpeedButton inherited GroupInBtn: TSpeedButton
Left = 216 AnchorSideTop.Control = SigmaOptns
Top = 326 Left = 163
Anchors = [akLeft] Top = 291
Visible = False Visible = False
end end
inherited GroupOutBtn: TSpeedButton inherited GroupOutBtn: TSpeedButton
Left = 217 Left = 163
Top = 354 Top = 321
Visible = False Visible = False
end end
object Label3: TLabel[12] object Label3: TLabel[16]
AnchorSideLeft.Control = Label4 AnchorSideLeft.Control = PLabel
AnchorSideTop.Control = NEdit AnchorSideTop.Control = NEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = NEdit AnchorSideRight.Control = NEdit
Left = 270 Left = 166
Height = 15 Height = 15
Top = 95 Top = 87
Width = 114 Width = 114
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 8 BorderSpacing.Right = 8
Caption = 'No. of Parts Sampled:' Caption = 'No. of Parts Sampled:'
ParentColor = False ParentColor = False
end end
object NEdit: TEdit[13] object NEdit: TEdit[17]
AnchorSideTop.Control = MeasEdit AnchorSideTop.Control = MeasEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = MeasEdit AnchorSideRight.Control = MeasEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 392 Left = 288
Height = 23 Height = 23
Top = 91 Top = 83
Width = 64 Width = 64
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -78,12 +106,12 @@ inherited PChartForm: TPChartForm
TabOrder = 2 TabOrder = 2
Text = 'NEdit' Text = 'NEdit'
end end
object Label4: TLabel[14] object PLabel: TLabel[18]
AnchorSideTop.Control = PEdit AnchorSideTop.Control = PEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 272 Left = 168
Height = 30 Height = 30
Top = 118 Top = 110
Width = 108 Width = 108
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -91,14 +119,14 @@ inherited PChartForm: TPChartForm
Caption = 'Expected Proportion'#13#10'of Defects:' Caption = 'Expected Proportion'#13#10'of Defects:'
ParentColor = False ParentColor = False
end end
object PEdit: TEdit[15] object PEdit: TEdit[19]
AnchorSideTop.Control = NEdit AnchorSideTop.Control = NEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = MeasEdit AnchorSideRight.Control = MeasEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 392 Left = 288
Height = 23 Height = 23
Top = 122 Top = 114
Width = 64 Width = 64
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -106,31 +134,31 @@ inherited PChartForm: TPChartForm
TabOrder = 3 TabOrder = 3
Text = 'PEdit' Text = 'PEdit'
end end
object SigmaOpts: TRadioGroup[16] object SigmaOptns: TRadioGroup[20]
AnchorSideLeft.Control = MeasEdit AnchorSideLeft.Control = MeasInBtn
AnchorSideTop.Control = PEdit AnchorSideTop.Control = PEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 248 Left = 163
Height = 128 Height = 114
Top = 169 Top = 161
Width = 208 Width = 171
Anchors = [akTop, akLeft, akRight]
AutoFill = True AutoFill = True
AutoSize = True
BorderSpacing.Top = 24 BorderSpacing.Top = 24
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Sigma Units for UCL and LCL' Caption = 'Sigma Units for UCL and LCL'
ChildSizing.LeftRightSpacing = 12 ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6 ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
ClientHeight = 108 ClientHeight = 94
ClientWidth = 204 ClientWidth = 167
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'3 Sigma' '3 Sigma'
@ -140,18 +168,28 @@ inherited PChartForm: TPChartForm
) )
TabOrder = 4 TabOrder = 4
object XSigmaEdit: TEdit object XSigmaEdit: TEdit
AnchorSideRight.Control = SigmaOpts AnchorSideRight.Control = SigmaOptns
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 128 Left = 128
Height = 23 Height = 23
Top = 80 Top = 64
Width = 64 Width = 36
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
Constraints.MinWidth = 36
TabOrder = 0 TabOrder = 0
Text = 'XSigmaEdit' Text = 'XSigmaEdit'
end end
end end
end end
inherited ParamsSplitter: TSplitter
Left = 364
Height = 428
end
inherited PageControl: TPageControl
Left = 373
Height = 412
Width = 546
end
end end

View File

@ -14,13 +14,14 @@ type
TPChartForm = class(TBasicSPCForm) TPChartForm = class(TBasicSPCForm)
Label3: TLabel; Label3: TLabel;
Label4: TLabel; PLabel: TLabel;
NEdit: TEdit; NEdit: TEdit;
PEdit: TEdit; PEdit: TEdit;
SigmaOpts: TRadioGroup; SigmaOptns: TRadioGroup;
XSigmaEdit: TEdit; XSigmaEdit: TEdit;
procedure FormActivate(Sender: TObject);
protected protected
procedure AdjustConstraints; override;
procedure Compute; override; procedure Compute; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override; function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
@ -39,6 +40,30 @@ implementation
uses uses
Math, Globals, Utils, MainUnit, DataProcs; Math, Globals, Utils, MainUnit, DataProcs;
{ TPChartForm }
procedure TPChartForm.AdjustConstraints;
var
y: Integer;
begin
if GroupOutBtn.Visible then
y := GroupOutBtn.Top + GroupOutBtn.Height
else
y := SigmaOptns.Top + SigmaOptns.Height;
ParamsPanel.Constraints.MinHeight := y + VarList.BorderSpacing.Bottom +
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
ParamsPanel.Constraints.MinWidth := Max(
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
Max(SigmaOptns.Width, PLabel.Width + PLabel.BorderSpacing.Right + PEdit.Width) * 2 - MeasInBtn.Width
);
SigmaOptns.Anchors := SigmaOptns.Anchors + [akRight];
SigmaOptns.AnchorSideRight.Control := ParamsPanel;
end;
procedure TPChartForm.Compute; procedure TPChartForm.Compute;
var var
ColNoSelected: IntDyneVec = nil; ColNoSelected: IntDyneVec = nil;
@ -50,7 +75,7 @@ begin
SetLength(ColNoSelected, 1); SetLength(ColNoSelected, 1);
ColNoSelected[0] := MeasVar; ColNoSelected[0] := MeasVar;
case SigmaOpts.ItemIndex of case SigmaOptns.ItemIndex of
0: sigma := 3.0; 0: sigma := 3.0;
1: sigma := 2.0; 1: sigma := 2.0;
2: sigma := 1.0; 2: sigma := 1.0;
@ -122,39 +147,6 @@ begin
); );
end; end;
procedure TPChartForm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
HelpBtn.Constraints.MinWidth := w;
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
DisableAutoSizing;
try
SigmaOpts.AnchorSideRight.Control := nil;
VarList.Constraints.MinWidth := VarListLabel.Width;
ParamsPanel.Constraints.MinWidth := Max(
CloseBtn.Left + CloseBtn.Width - HelpBtn.Left + HelpBtn.BorderSpacing.Around,
SigmaOpts.Width * 2 + VarList.BorderSpacing.Right + VarList.BorderSpacing.Left
);
// Constraints.MinHeight := SigmaOpts.Top + SigmaOpts.Height + SigmaOpts.BorderSpacing.Bottom + ButtonPanel.Height;
SigmaOpts.AnchorSideRight.Control := MeasEdit;
SigmaOpts.AnchorSideRight.Side := asrBottom;
finally
EnableAutoSizing;
end;
Position := poDesigned;
FAutoSized := true;
end;
procedure TPChartForm.Reset; procedure TPChartForm.Reset;
begin begin
@ -204,14 +196,14 @@ begin
exit; exit;
end; end;
if SigmaOpts.ItemIndex = -1 then if SigmaOptns.ItemIndex = -1 then
begin begin
AMsg := 'Number of sigma units for UCL and LCL not specified.'; AMsg := 'Number of sigma units for UCL and LCL not specified.';
AControl := SigmaOpts; AControl := SigmaOptns;
exit; exit;
end; end;
if SigmaOpts.ItemIndex = 3 then if SigmaOptns.ItemIndex = 3 then
begin begin
if (XSigmaEdit.Text = '') then if (XSigmaEdit.Text = '') then
begin begin
@ -230,6 +222,7 @@ begin
Result := true; Result := true;
end; end;
end. end.

View File

@ -41,6 +41,9 @@ const
1.575, 1.566, 1.557, 1.548, 1.541 // 21..25 1.575, 1.566, 1.557, 1.548, 1.541 // 21..25
); );
{ TRChartForm }
procedure TRChartForm.Compute; procedure TRChartForm.Compute;
var var
i, j: Integer; i, j: Integer;

View File

@ -35,6 +35,9 @@ implementation
uses uses
Math, Globals, MathUnit, Utils, MainUnit, DataProcs; Math, Globals, MathUnit, Utils, MainUnit, DataProcs;
{ TSChartForm }
procedure TSChartForm.Compute; procedure TSChartForm.Compute;
var var
UCL, LCL: Double; UCL, LCL: Double;
@ -79,7 +82,7 @@ begin
for j := 0 to numGrps-1 do // groups for j := 0 to numGrps-1 do // groups
begin begin
xmin := Infinity; xmin := Infinity;
xmax := -Infinity; xmax := NegInfinity;
for i := 1 to NoCases do for i := 1 to NoCases do
begin begin
if not GoodRecord(i, Length(ColNoSelected), ColNoSelected) then continue; if not GoodRecord(i, Length(ColNoSelected), ColNoSelected) then continue;

View File

@ -3,57 +3,74 @@ inherited UChartForm: TUChartForm
HelpKeyword = 'html/DefectsperUnituChart.htm' HelpKeyword = 'html/DefectsperUnituChart.htm'
Caption = 'Defects per unit U Control Chart' Caption = 'Defects per unit U Control Chart'
inherited ParamsPanel: TPanel inherited ParamsPanel: TPanel
Width = 432 Width = 320
ClientWidth = 432 ClientWidth = 320
inherited CloseBtn: TButton
Left = 265
TabOrder = 8
end
inherited ComputeBtn: TButton
Left = 181
end
inherited ResetBtn: TButton
Left = 119
end
inherited HelpBtn: TButton
Left = 60
TabOrder = 7
end
inherited ButtonBevel: TBevel
Width = 320
end
inherited VarList: TListBox inherited VarList: TListBox
Width = 188 Width = 139
end end
inherited GroupLabel: TLabel inherited GroupLabel: TLabel
Left = 236 Left = 181
Top = 302 Top = 302
Visible = False Visible = False
end end
inherited GroupEdit: TEdit inherited GroupEdit: TEdit
Left = 236 Left = 181
Top = 319 Top = 319
Width = 196 Width = 139
TabOrder = 4 TabOrder = 4
Visible = False Visible = False
end end
inherited MeasLabel: TLabel inherited MeasLabel: TLabel
Left = 236 Left = 181
end end
inherited MeasEdit: TEdit inherited MeasEdit: TEdit
Left = 236 Left = 181
Width = 196 Width = 139
end end
inherited Bevel2: TBevel inherited Bevel2: TBevel
Left = 205 Left = 149
end end
inherited MeasInBtn: TSpeedButton inherited MeasInBtn: TSpeedButton
Left = 204 Left = 147
end end
inherited MeasOutBtn: TSpeedButton inherited MeasOutBtn: TSpeedButton
Left = 205 Left = 147
end end
inherited GroupInBtn: TSpeedButton inherited GroupInBtn: TSpeedButton
Left = 204 Left = 147
Top = 300 Top = 300
Anchors = [akLeft] Anchors = [akLeft]
Visible = False Visible = False
end end
inherited GroupOutBtn: TSpeedButton inherited GroupOutBtn: TSpeedButton
Left = 205 Left = 147
Top = 328 Top = 330
Visible = False Visible = False
end end
object Label3: TLabel[12] object Label3: TLabel[16]
AnchorSideTop.Control = NoInspEdit AnchorSideTop.Control = NoInspEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = NoInspEdit AnchorSideRight.Control = NoInspEdit
Left = 288 Left = 176
Height = 30 Height = 30
Top = 83 Top = 75
Width = 73 Width = 73
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -61,14 +78,14 @@ inherited UChartForm: TUChartForm
Caption = 'No. inspected'#13#10'per group:' Caption = 'No. inspected'#13#10'per group:'
ParentColor = False ParentColor = False
end end
object NoInspEdit: TEdit[13] object NoInspEdit: TEdit[17]
AnchorSideTop.Control = MeasEdit AnchorSideTop.Control = MeasEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = MeasEdit AnchorSideRight.Control = MeasEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 369 Left = 257
Height = 23 Height = 23
Top = 87 Top = 79
Width = 63 Width = 63
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -76,31 +93,31 @@ inherited UChartForm: TUChartForm
TabOrder = 2 TabOrder = 2
Text = 'NoInspEdit' Text = 'NoInspEdit'
end end
object SigmaOpts: TRadioGroup[14] object SigmaOptns: TRadioGroup[18]
AnchorSideLeft.Control = MeasEdit AnchorSideLeft.Control = MeasInBtn
AnchorSideTop.Control = NoInspEdit AnchorSideTop.Control = NoInspEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SpecsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 236 Left = 147
Height = 128 Height = 114
Top = 134 Top = 126
Width = 196 Width = 171
Anchors = [akTop, akLeft, akRight]
AutoFill = True AutoFill = True
AutoSize = True
BorderSpacing.Top = 24 BorderSpacing.Top = 24
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'Sigma Units for UCL and LCL' Caption = 'Sigma Units for UCL and LCL'
ChildSizing.LeftRightSpacing = 12 ChildSizing.LeftRightSpacing = 12
ChildSizing.TopBottomSpacing = 6 ChildSizing.TopBottomSpacing = 6
ChildSizing.VerticalSpacing = 2
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
ClientHeight = 108 ClientHeight = 94
ClientWidth = 192 ClientWidth = 167
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'3 Sigma' '3 Sigma'
@ -110,18 +127,26 @@ inherited UChartForm: TUChartForm
) )
TabOrder = 3 TabOrder = 3
object XSigmaEdit: TEdit object XSigmaEdit: TEdit
AnchorSideRight.Control = SigmaOpts AnchorSideRight.Control = SigmaOptns
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 128 Left = 128
Height = 23 Height = 23
Top = 80 Top = 66
Width = 52 Width = 36
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
Constraints.MinWidth = 36
TabOrder = 0 TabOrder = 0
Text = 'XSigmaEdit' Text = 'XSigmaEdit'
end end
end end
end end
inherited ParamsSplitter: TSplitter
Left = 332
end
inherited PageControl: TPageControl
Left = 341
Width = 578
end
end end

View File

@ -15,10 +15,10 @@ type
TUChartForm = class(TBasicSPCForm) TUChartForm = class(TBasicSPCForm)
Label3: TLabel; Label3: TLabel;
NoInspEdit: TEdit; NoInspEdit: TEdit;
SigmaOpts: TRadioGroup; SigmaOptns: TRadioGroup;
XSigmaEdit: TEdit; XSigmaEdit: TEdit;
procedure FormActivate(Sender: TObject);
protected protected
procedure AdjustConstraints; override;
procedure Compute; override; procedure Compute; override;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override; function Validate(out AMsg: String; out AControl: TWinControl): Boolean; override;
@ -37,8 +37,29 @@ implementation
uses uses
Math, Globals, MainUnit, DataProcs; Math, Globals, MainUnit, DataProcs;
{ TUChartForm } { TUChartForm }
procedure TUChartForm.AdjustConstraints;
var
y: Integer;
begin
if GroupOutBtn.Visible then
y := GroupOutBtn.Top + GroupOutBtn.Height
else
y := SigmaOptns.Top + SigmaOptns.Height;
ParamsPanel.Constraints.MinHeight := y + VarList.BorderSpacing.Bottom +
ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
ParamsPanel.Constraints.MinWidth := Max(
4*CloseBtn.Width + 3*CloseBtn.BorderSpacing.Left,
SigmaOptns.Width * 2 - MeasInBtn.Width
);
SigmaOptns.Anchors := SigmaOptns.Anchors + [akRight];
SigmaOptns.AnchorSideRight.Control := ParamsPanel;
end;
procedure TUChartForm.Compute; procedure TUChartForm.Compute;
var var
ColNoSelected: IntDyneVec = nil; ColNoSelected: IntDyneVec = nil;
@ -51,7 +72,7 @@ begin
SetLength(ColNoSelected, 1); SetLength(ColNoSelected, 1);
ColNoSelected[0] := MeasVar; ColNoSelected[0] := MeasVar;
case SigmaOpts.ItemIndex of case SigmaOptns.ItemIndex of
0: sigma := 3.0; 0: sigma := 3.0;
1: sigma := 2.0; 1: sigma := 2.0;
2: sigma := 1.0; 2: sigma := 1.0;
@ -114,40 +135,6 @@ begin
end; end;
procedure TUChartForm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
HelpBtn.Constraints.MinWidth := w;
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
DisableAutoSizing;
try
SigmaOpts.AnchorSideRight.Control := nil;
VarList.Constraints.MinWidth := VarListLabel.Width;
ParamsPanel.Constraints.MinWidth := Max(
CloseBtn.Left + CloseBtn.Width - HelpBtn.Left + HelpBtn.BorderSpacing.Around,
SigmaOpts.Width * 2 + VarList.BorderSpacing.Right + VarList.BorderSpacing.Left
);
// Constraints.MinHeight := SigmaOpts.Top + SigmaOpts.Height + SigmaOpts.BorderSpacing.Bottom + ButtonPanel.Height;
SigmaOpts.AnchorSideRight.Control := MeasEdit;
SigmaOpts.AnchorSideRight.Side := asrBottom;
finally
EnableAutoSizing;
end;
Position := poDesigned;
FAutoSized := true;
end;
procedure TUChartForm.Reset; procedure TUChartForm.Reset;
begin begin
inherited; inherited;
@ -181,14 +168,14 @@ begin
exit; exit;
end; end;
if SigmaOpts.ItemIndex = -1 then if SigmaOptns.ItemIndex = -1 then
begin begin
AMsg := 'Number of sigma units for UCL and LCL not specified.'; AMsg := 'Number of sigma units for UCL and LCL not specified.';
AControl := SigmaOpts; AControl := SigmaOptns;
exit; exit;
end; end;
if SigmaOpts.ItemIndex = 3 then if SigmaOptns.ItemIndex = 3 then
begin begin
if (XSigmaEdit.Text = '') then if (XSigmaEdit.Text = '') then
begin begin

View File

@ -69,6 +69,9 @@ uses
{$R *.lfm} {$R *.lfm}
{ TXBarChartForm }
procedure TXBarChartForm.AdjustConstraints; procedure TXBarChartForm.AdjustConstraints;
begin begin
ParamsPanel.Constraints.MinWidth := Max( ParamsPanel.Constraints.MinWidth := Max(