LazStats: Inherit form in BackRegUnit from TBasicStatsReportForm.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7788 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-10-20 21:43:15 +00:00
parent 8bdb1bd4d4
commit f51fb9906f
2 changed files with 407 additions and 446 deletions

View File

@@ -1,363 +1,317 @@
object BackRegFrm: TBackRegFrm inherited BackRegFrm: TBackRegFrm
Left = 622 Left = 622
Height = 436 Height = 398
Top = 187 Top = 187
Width = 463 Width = 853
HelpType = htKeyword HelpType = htKeyword
HelpKeyword = 'html/BackwardStepwise.htm' HelpKeyword = 'html/BackwardStepwise.htm'
AutoSize = True
Caption = 'Stepwise Backward Multiple Regression' Caption = 'Stepwise Backward Multiple Regression'
ClientHeight = 436 ClientHeight = 398
ClientWidth = 463 ClientWidth = 853
OnActivate = FormActivate inherited ParamsPanel: TPanel
OnCreate = FormCreate Height = 382
OnShow = FormShow Width = 432
Position = poMainFormCenter ClientHeight = 382
LCLVersion = '2.1.0.0' ClientWidth = 432
object Label1: TLabel inherited CloseBtn: TButton
AnchorSideLeft.Control = Owner Left = 377
AnchorSideTop.Control = Owner Top = 357
Left = 8 TabOrder = 12
Height = 15 end
Top = 8 inherited ComputeBtn: TButton
Width = 97 Left = 293
BorderSpacing.Left = 8 Top = 357
BorderSpacing.Top = 8 TabOrder = 11
Caption = 'Available Variables' end
ParentColor = False inherited ResetBtn: TButton
end Left = 231
object Label2: TLabel Top = 357
AnchorSideLeft.Control = SelList TabOrder = 10
AnchorSideTop.Control = InBtn end
Left = 262 inherited HelpBtn: TButton
Height = 15 Left = 172
Top = 109 Top = 357
Width = 127 TabOrder = 9
Caption = 'Variables to be Analyzed' end
ParentColor = False inherited ButtonBevel: TBevel
end Top = 341
object Label3: TLabel Width = 432
AnchorSideLeft.Control = DepVar end
AnchorSideTop.Side = asrBottom object Label1: TLabel[5]
AnchorSideBottom.Control = DepVar AnchorSideLeft.Control = ParamsPanel
Left = 262 AnchorSideTop.Control = ParamsPanel
Height = 15 Left = 0
Top = 33 Height = 15
Width = 102 Top = 0
Anchors = [akLeft, akBottom] Width = 97
BorderSpacing.Bottom = 2 Caption = 'Available Variables'
Caption = 'Dependent Variable' ParentColor = False
ParentColor = False end
end object Label2: TLabel[6]
object VarList: TListBox AnchorSideLeft.Control = SelList
AnchorSideLeft.Control = Owner AnchorSideTop.Control = InBtn
AnchorSideTop.Control = Label1 Left = 240
AnchorSideTop.Side = asrBottom Height = 15
AnchorSideRight.Control = AllBtn Top = 97
AnchorSideBottom.Control = GroupBox1 Width = 127
Left = 8 Caption = 'Variables to be Analyzed'
Height = 220 ParentColor = False
Top = 25 end
Width = 192 object Label3: TLabel[7]
Anchors = [akTop, akLeft, akRight, akBottom] AnchorSideLeft.Control = DepVarEdit
BorderSpacing.Left = 8 AnchorSideTop.Side = asrBottom
BorderSpacing.Top = 2 AnchorSideBottom.Control = DepVarEdit
BorderSpacing.Right = 8 Left = 244
BorderSpacing.Bottom = 8 Height = 15
Constraints.MinHeight = 220 Top = 21
ItemHeight = 0 Width = 102
MultiSelect = True Anchors = [akLeft, akBottom]
OnSelectionChange = VarListSelectionChange BorderSpacing.Bottom = 2
TabOrder = 0 Caption = 'Dependent Variable'
end ParentColor = False
object InBtn: TBitBtn end
AnchorSideLeft.Control = Owner object VarList: TListBox[8]
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = DepOutBtn AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 AnchorSideRight.Control = AllBtn
Height = 28 AnchorSideBottom.Control = OptionsGroup
Top = 109 Left = 0
Width = 28 Height = 181
BorderSpacing.Top = 24 Top = 17
Images = MainDataModule.ImageList Width = 192
ImageIndex = 1 Anchors = [akTop, akLeft, akRight, akBottom]
OnClick = InBtnClick BorderSpacing.Top = 2
Spacing = 0 BorderSpacing.Right = 4
TabOrder = 4 BorderSpacing.Bottom = 8
end ItemHeight = 0
object OutBtn: TBitBtn MultiSelect = True
AnchorSideLeft.Control = Owner OnDblClick = VarListDblClick
AnchorSideLeft.Side = asrCenter OnSelectionChange = VarListSelectionChange
AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom
Left = 217
Height = 28
Top = 141
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 5
end
object AllBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom
Left = 208
Height = 25
Top = 193
Width = 46
AutoSize = True
BorderSpacing.Top = 24
Caption = 'ALL'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 6
end
object SelList: TListBox
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1
Left = 262
Height = 118
Top = 126
Width = 193
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnSelectionChange = VarListSelectionChange
TabOrder = 7
end
object DepInBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList
Left = 217
Height = 28
Top = 25
Width = 28
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 1
end
object DepOutBtn: TBitBtn
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 217
Height = 28
Top = 57
Width = 28
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 2
end
object DepVar: TEdit
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 262
Height = 23
Top = 50
Width = 193
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'DepVar'
end
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideBottom.Control = Bevel1
Left = 8
Height = 135
Top = 252
Width = 439
Anchors = [akLeft, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Options'
ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 24
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5
ClientHeight = 115
ClientWidth = 435
TabOrder = 8
object MatInChkBox: TCheckBox
Left = 16
Height = 19
Top = 6
Width = 222
Caption = 'Get Data from a matrix file (max.=200)'
TabOrder = 0 TabOrder = 0
end end
object MatSaveChkBox: TCheckBox object InBtn: TBitBtn[9]
Left = 16 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 27 AnchorSideTop.Control = DepOutBtn
Width = 222 AnchorSideTop.Side = asrBottom
Caption = 'Save the correlation matrix' Left = 203
TabOrder = 1 Height = 26
end Top = 97
object CPChkBox: TCheckBox Width = 26
Left = 16 BorderSpacing.Top = 24
Height = 19 Images = MainDataModule.ImageList
Top = 48 ImageIndex = 1
Width = 222 OnClick = InBtnClick
Caption = 'Show Cross-Products Matrix' Spacing = 0
TabOrder = 2
end
object CovChkBox: TCheckBox
Left = 16
Height = 19
Top = 69
Width = 222
Caption = 'Show Variance-Covariance Matrix'
TabOrder = 3
end
object CorrsChkBox: TCheckBox
Left = 16
Height = 19
Top = 90
Width = 222
Caption = 'Show Intercorrelation Matrix'
TabOrder = 4 TabOrder = 4
end end
object MeansChkBox: TCheckBox object OutBtn: TBitBtn[10]
Left = 262 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 6 AnchorSideTop.Control = InBtn
Width = 157 AnchorSideTop.Side = asrBottom
Caption = 'Show Means' Left = 203
Height = 26
Top = 127
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = OutBtnClick
Spacing = 0
TabOrder = 5 TabOrder = 5
end end
object VarChkBox: TCheckBox object AllBtn: TBitBtn[11]
Left = 262 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 27 AnchorSideTop.Control = OutBtn
Width = 157 AnchorSideTop.Side = asrBottom
Caption = 'Show Variances' Left = 196
Height = 25
Top = 177
Width = 40
AutoSize = True
BorderSpacing.Top = 24
Caption = 'All'
OnClick = AllBtnClick
Spacing = 0
TabOrder = 6 TabOrder = 6
end end
object SDChkBox: TCheckBox object SelList: TListBox[12]
Left = 262 AnchorSideLeft.Control = AllBtn
Height = 19 AnchorSideLeft.Side = asrBottom
Top = 48 AnchorSideTop.Control = Label2
Width = 157 AnchorSideTop.Side = asrBottom
Caption = 'Show Standard Deviations' AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = OptionsGroup
Left = 240
Height = 84
Top = 114
Width = 192
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 4
BorderSpacing.Top = 2
BorderSpacing.Bottom = 8
ItemHeight = 0
MultiSelect = True
OnDblClick = SelListDblClick
OnSelectionChange = VarListSelectionChange
TabOrder = 7 TabOrder = 7
end end
object PartialsChkBox: TCheckBox object DepInBtn: TBitBtn[13]
Left = 262 AnchorSideLeft.Control = ParamsPanel
Height = 19 AnchorSideLeft.Side = asrCenter
Top = 69 AnchorSideTop.Control = VarList
Width = 157 Left = 203
Caption = 'Show Partial Correlations' Height = 26
Top = 17
Width = 26
Images = MainDataModule.ImageList
ImageIndex = 1
OnClick = DepInBtnClick
Spacing = 0
TabOrder = 1
end
object DepOutBtn: TBitBtn[14]
AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom
Left = 203
Height = 26
Top = 47
Width = 26
BorderSpacing.Top = 4
Images = MainDataModule.ImageList
ImageIndex = 0
OnClick = DepOutBtnClick
Spacing = 0
TabOrder = 2
end
object DepVarEdit: TEdit[15]
AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom
Left = 244
Height = 23
Top = 38
Width = 188
Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 12
ReadOnly = True
TabOrder = 3
Text = 'DepVarEdit'
end
object OptionsGroup: TGroupBox[16]
AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = ButtonBevel
Left = 0
Height = 135
Top = 206
Width = 439
Anchors = [akLeft, akBottom]
AutoSize = True
Caption = 'Options'
ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6
ChildSizing.HorizontalSpacing = 24
ChildSizing.VerticalSpacing = 2
ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5
ClientHeight = 115
ClientWidth = 435
TabOrder = 8 TabOrder = 8
object MatInChkBox: TCheckBox
Left = 16
Height = 19
Top = 6
Width = 222
Caption = 'Get Data from a matrix file (max.=200)'
TabOrder = 0
end
object MatSaveChkBox: TCheckBox
Left = 16
Height = 19
Top = 27
Width = 222
Caption = 'Save the correlation matrix'
TabOrder = 1
end
object CPChkBox: TCheckBox
Left = 16
Height = 19
Top = 48
Width = 222
Caption = 'Show Cross-Products Matrix'
TabOrder = 2
end
object CovChkBox: TCheckBox
Left = 16
Height = 19
Top = 69
Width = 222
Caption = 'Show Variance-Covariance Matrix'
TabOrder = 3
end
object CorrsChkBox: TCheckBox
Left = 16
Height = 19
Top = 90
Width = 222
Caption = 'Show Intercorrelation Matrix'
TabOrder = 4
end
object MeansChkBox: TCheckBox
Left = 262
Height = 19
Top = 6
Width = 157
Caption = 'Show Means'
TabOrder = 5
end
object VarChkBox: TCheckBox
Left = 262
Height = 19
Top = 27
Width = 157
Caption = 'Show Variances'
TabOrder = 6
end
object SDChkBox: TCheckBox
Left = 262
Height = 19
Top = 48
Width = 157
Caption = 'Show Standard Deviations'
TabOrder = 7
end
object PartialsChkBox: TCheckBox
Left = 262
Height = 19
Top = 69
Width = 157
Caption = 'Show Partial Correlations'
TabOrder = 8
end
end end
end end
object ResetBtn: TButton inherited ParamsSplitter: TSplitter
AnchorSideRight.Control = ComputeBtn Left = 444
AnchorSideBottom.Control = Owner Height = 398
AnchorSideBottom.Side = asrBottom
Left = 254
Height = 25
Top = 403
Width = 54
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Reset'
OnClick = ResetBtnClick
TabOrder = 9
end end
object ComputeBtn: TButton object OpenDialog1: TOpenDialog[2]
AnchorSideRight.Control = CloseBtn
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 316
Height = 25
Top = 403
Width = 76
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Compute'
OnClick = ComputeBtnClick
TabOrder = 10
end
object CloseBtn: TButton
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 400
Height = 25
Top = 403
Width = 55
Anchors = [akRight, akBottom]
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'Close'
ModalResult = 11
OnClick = CloseBtnClick
TabOrder = 11
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = CloseBtn
Left = 0
Height = 8
Top = 387
Width = 463
Anchors = [akLeft, akRight, akBottom]
Shape = bsBottomLine
end
object OpenDialog1: TOpenDialog
Left = 64 Left = 64
Top = 72 Top = 72
end end
object SaveDialog1: TSaveDialog object SaveDialog1: TSaveDialog[3]
Left = 56 Left = 56
Top = 168 Top = 168
end end

View File

@@ -5,20 +5,17 @@ unit BackRegUnit;
interface interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, Math, StdCtrls, Buttons, ExtCtrls,
Globals, MainDM, MainUnit, MatrixLib, OutputUnit, FunctionsLib, DataProcs; Globals, MainDM, MainUnit, MatrixLib, FunctionsLib, DataProcs,
BasicStatsReportFormUnit;
type type
{ TBackRegFrm } { TBackRegFrm }
TBackRegFrm = class(TForm) TBackRegFrm = class(TBasicStatsReportForm)
Bevel1: TBevel;
OpenDialog1: TOpenDialog; OpenDialog1: TOpenDialog;
ResetBtn: TButton;
ComputeBtn: TButton;
CloseBtn: TButton;
InBtn: TBitBtn; InBtn: TBitBtn;
OutBtn: TBitBtn; OutBtn: TBitBtn;
AllBtn: TBitBtn; AllBtn: TBitBtn;
@@ -34,102 +31,63 @@ type
VarChkBox: TCheckBox; VarChkBox: TCheckBox;
SDChkBox: TCheckBox; SDChkBox: TCheckBox;
PartialsChkBox: TCheckBox; PartialsChkBox: TCheckBox;
DepVar: TEdit; DepVarEdit: TEdit;
GroupBox1: TGroupBox; OptionsGroup: TGroupBox;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
Label3: TLabel; Label3: TLabel;
SelList: TListBox; SelList: TListBox;
VarList: TListBox; VarList: TListBox;
procedure AllBtnClick(Sender: TObject); procedure AllBtnClick(Sender: TObject);
procedure CancelBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
procedure DepInBtnClick(Sender: TObject); procedure DepInBtnClick(Sender: TObject);
procedure DepOutBtnClick(Sender: TObject); procedure DepOutBtnClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure InBtnClick(Sender: TObject); procedure InBtnClick(Sender: TObject);
procedure OutBtnClick(Sender: TObject); procedure OutBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject); procedure SelListDblClick(Sender: TObject);
procedure CloseBtnClick(Sender: TObject); procedure VarListDblClick(Sender: TObject);
procedure VarListSelectionChange(Sender: TObject; User: boolean); procedure VarListSelectionChange(Sender: TObject; User: boolean);
private private
{ private declarations }
FAutoSized: Boolean; protected
procedure UpdateBtnStates; procedure AdjustConstraints; override;
procedure Compute; override;
procedure UpdateBtnStates; override;
public public
{ public declarations } procedure Reset; override;
end; end;
var var
BackRegFrm: TBackRegFrm; BackRegFrm: TBackRegFrm;
implementation implementation
{$R *.lfm}
uses uses
Math,
Utils; Utils;
{ TBackRegFrm } { TBackRegFrm }
procedure TBackRegFrm.ResetBtnClick(Sender: TObject); procedure TBackRegFrm.AdjustConstraints;
var
i: integer;
begin begin
VarList.Clear; inherited;
SelList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
CPChkBox.Checked := false; ParamsPanel.Constraints.MinWidth := Max(
CovChkBox.Checked := false; OptionsGroup.Width,
CorrsChkBox.Checked := true; 4*CloseBtn.Width + 3*closeBtn.BorderSpacing.Left
MeansChkBox.Checked := true; );
VarChkBox.Checked := false;
SDChkBox.Checked := true; ParamsPanel.Constraints.MinHeight :=
MatInChkBox.Checked := false; AllBtn.Top + AllBtn.Height + VarList.BorderSpacing.Bottom +
MatSaveChkBox.Checked := false; OptionsGroup.Height + ButtonBevel.Height + CloseBtn.BorderSpacing.Top + CloseBtn.Height;
PartialsChkBox.Checked := false;
DepVar.Text := '';
end; end;
procedure TBackRegFrm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
procedure TBackRegFrm.CloseBtnClick(Sender: TObject);
begin
Close;
end;
procedure TBackRegFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
ResetBtn.Constraints.MinWidth := w;
ComputeBtn.Constraints.MinWidth := w;
CloseBtn.Constraints.MinWidth := w;
Constraints.MinWidth := Width;
Constraints.MinHeight := Height;
FAutoSized := true;
end;
procedure TBackRegFrm.FormCreate(Sender: TObject);
begin
Assert(OS3MainFrm <> nil);
end;
procedure TBackRegFrm.FormShow(Sender: TObject);
begin
ResetBtnClick(self);
end;
procedure TBackRegFrm.AllBtnClick(Sender: TObject); procedure TBackRegFrm.AllBtnClick(Sender: TObject);
var var
@@ -141,12 +99,8 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBackRegFrm.CancelBtnClick(Sender: TObject);
begin
Close;
end;
procedure TBackRegFrm.ComputeBtnClick(Sender: TObject); procedure TBackRegFrm.Compute;
var var
NoVars, NoIndepVars, i, j, NCases, StepNo : integer; NoVars, NoIndepVars, i, j, NCases, StepNo : integer;
Index: integer; Index: integer;
@@ -204,7 +158,7 @@ begin
Variances[i] := sqr(StdDevs[i]); Variances[i] := sqr(StdDevs[i]);
ColNoSelected[i] := i+1; ColNoSelected[i] := i+1;
end; end;
DepVar.Text := RowLabels[NoVars-1]; DepVarEdit.Text := RowLabels[NoVars-1];
for i := 0 to NoVars-2 do SelList.Items.Add(RowLabels[i]); for i := 0 to NoVars-2 do SelList.Items.Add(RowLabels[i]);
CPChkBox.Checked := false; CPChkBox.Checked := false;
CovChkBox.Checked := false; CovChkBox.Checked := false;
@@ -236,7 +190,7 @@ begin
end; end;
end; end;
{ get dependendent variable column } { get dependendent variable column }
if DepVar.Text = '' then if DepVarEdit.Text = '' then
begin begin
MessageDlg('No Dependent variable selected.', mtError, [mbOK], 0); MessageDlg('No Dependent variable selected.', mtError, [mbOK], 0);
exit; exit;
@@ -244,11 +198,11 @@ begin
NoVars := NoVars + 1; NoVars := NoVars + 1;
for j := 1 to NoVariables do for j := 1 to NoVariables do
begin begin
if DepVar.Text = OS3MainFrm.DataGrid.Cells[j,0] then if DepVarEdit.Text = OS3MainFrm.DataGrid.Cells[j,0] then
begin begin
ColNoSelected[NoVars-1] := j; ColNoSelected[NoVars-1] := j;
RowLabels[NoVars-1] := DepVar.Text; RowLabels[NoVars-1] := DepVarEdit.Text;
ColLabels[NoVars-1] := DepVar.Text; ColLabels[NoVars-1] := DepVarEdit.Text;
end; end;
end; end;
end; end;
@@ -379,49 +333,39 @@ begin
NoVars := 0; NoVars := 0;
end; end;
DisplayReport(lReport); FReportFrame.DisplayReport(lReport);
finally finally
lReport.Free; lReport.Free;
ColNoSelected := nil;
IndepIndex := nil;
BetaWeights := nil;
CorrMat := nil;
ProdMat := nil;
InverseMat := nil;
ColLabels := nil;
RowLabels := nil;
StdDevs := nil;
Variances := nil;
Means := nil;
Corrs := nil;
end; end;
end; end;
procedure TBackRegFrm.DepInBtnClick(Sender: TObject); procedure TBackRegFrm.DepInBtnClick(Sender: TObject);
var var
index: integer; index: integer;
begin begin
index := varList.ItemIndex; index := varList.ItemIndex;
if (index > -1) and (DepVar.Text = '') then if (index > -1) and (DepVarEdit.Text = '') then
begin begin
DepVar.Text := VarList.Items[index]; DepVarEdit.Text := VarList.Items[index];
VarList.Items.Delete(index); VarList.Items.Delete(index);
end; end;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBackRegFrm.DepOutBtnClick(Sender: TObject); procedure TBackRegFrm.DepOutBtnClick(Sender: TObject);
begin begin
if DepVar.Text <> '' then if DepVarEdit.Text <> '' then
begin begin
SelList.Items.Add(DepVar.Text); SelList.Items.Add(DepVarEdit.Text);
DepVar.Text := ''; DepVarEdit.Text := '';
end; end;
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBackRegFrm.InBtnClick(Sender: TObject); procedure TBackRegFrm.InBtnClick(Sender: TObject);
var var
i: integer; i: integer;
@@ -441,6 +385,7 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBackRegFrm.OutBtnClick(Sender: TObject); procedure TBackRegFrm.OutBtnClick(Sender: TObject);
var var
i: Integer; i: Integer;
@@ -460,21 +405,83 @@ begin
UpdateBtnStates; UpdateBtnStates;
end; end;
procedure TBackRegFrm.Reset;
var
i: integer;
begin
inherited;
DepVarEdit.Clear;
VarList.Clear;
SelList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
CPChkBox.Checked := false;
CovChkBox.Checked := false;
CorrsChkBox.Checked := false;
MeansChkBox.Checked := false;
VarChkBox.Checked := false;
SDChkBox.Checked := false;
MatInChkBox.Checked := false;
MatSaveChkBox.Checked := false;
PartialsChkBox.Checked := false;
UpdateBtnStates;
end;
procedure TBackRegFrm.SelListDblClick(Sender: TObject);
var
index: Integer;
begin
index := SelList.ItemIndex;
if index > -1 then
begin
Varlist.Items.Add(SelList.Items[index]);
SelList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TBackRegFrm.UpdateBtnStates; procedure TBackRegFrm.UpdateBtnStates;
var var
lSelected: Boolean; lSelected: Boolean;
begin begin
inherited;
lSelected := AnySelected(VarList); lSelected := AnySelected(VarList);
DepInBtn.Enabled := lSelected and (DepVar.Text = ''); DepInBtn.Enabled := lSelected and (DepVarEdit.Text = '');
InBtn.Enabled := lSelected; InBtn.Enabled := lSelected;
DepOutBtn.Enabled := DepVar.Text <> ''; DepOutBtn.Enabled := DepVarEdit.Text <> '';
OutBtn.Enabled := AnySelected(SelList); OutBtn.Enabled := AnySelected(SelList);
end; end;
initialization procedure TBackRegFrm.VarListDblClick(Sender: TObject);
{$I backregunit.lrs} var
index: Integer;
begin
index := VarList.ItemIndex;
if index > -1 then
begin
if DepVarEdit.Text = '' then
DepVarEdit.Text := VarList.Items[index]
else
SelList.Items.Add(VarList.Items[index]);
VarList.Items.Delete(index);
UpdateBtnStates;
end;
end;
procedure TBackRegFrm.VarListSelectionChange(Sender: TObject; User: boolean);
begin
UpdateBtnStates;
end;
end. end.