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,84 +1,104 @@
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
end
inherited ComputeBtn: TButton
Left = 293
Top = 357
TabOrder = 11
end
inherited ResetBtn: TButton
Left = 231
Top = 357
TabOrder = 10
end
inherited HelpBtn: TButton
Left = 172
Top = 357
TabOrder = 9
end
inherited ButtonBevel: TBevel
Top = 341
Width = 432
end
object Label1: TLabel[5]
AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = ParamsPanel
Left = 0
Height = 15 Height = 15
Top = 8 Top = 0
Width = 97 Width = 97
BorderSpacing.Left = 8
BorderSpacing.Top = 8
Caption = 'Available Variables' Caption = 'Available Variables'
ParentColor = False ParentColor = False
end end
object Label2: TLabel object Label2: TLabel[6]
AnchorSideLeft.Control = SelList AnchorSideLeft.Control = SelList
AnchorSideTop.Control = InBtn AnchorSideTop.Control = InBtn
Left = 262 Left = 240
Height = 15 Height = 15
Top = 109 Top = 97
Width = 127 Width = 127
Caption = 'Variables to be Analyzed' Caption = 'Variables to be Analyzed'
ParentColor = False ParentColor = False
end end
object Label3: TLabel object Label3: TLabel[7]
AnchorSideLeft.Control = DepVar AnchorSideLeft.Control = DepVarEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = DepVar AnchorSideBottom.Control = DepVarEdit
Left = 262 Left = 244
Height = 15 Height = 15
Top = 33 Top = 21
Width = 102 Width = 102
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
Caption = 'Dependent Variable' Caption = 'Dependent Variable'
ParentColor = False ParentColor = False
end end
object VarList: TListBox object VarList: TListBox[8]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideTop.Control = Label1 AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AllBtn AnchorSideRight.Control = AllBtn
AnchorSideBottom.Control = GroupBox1 AnchorSideBottom.Control = OptionsGroup
Left = 8 Left = 0
Height = 220 Height = 181
Top = 25 Top = 17
Width = 192 Width = 192
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 8 BorderSpacing.Right = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Constraints.MinHeight = 220
ItemHeight = 0 ItemHeight = 0
MultiSelect = True MultiSelect = True
OnDblClick = VarListDblClick
OnSelectionChange = VarListSelectionChange OnSelectionChange = VarListSelectionChange
TabOrder = 0 TabOrder = 0
end end
object InBtn: TBitBtn object InBtn: TBitBtn[9]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepOutBtn AnchorSideTop.Control = DepOutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 203
Height = 28 Height = 26
Top = 109 Top = 97
Width = 28 Width = 26
BorderSpacing.Top = 24 BorderSpacing.Top = 24
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
@@ -86,15 +106,15 @@ object BackRegFrm: TBackRegFrm
Spacing = 0 Spacing = 0
TabOrder = 4 TabOrder = 4
end end
object OutBtn: TBitBtn object OutBtn: TBitBtn[10]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = InBtn AnchorSideTop.Control = InBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 203
Height = 28 Height = 26
Top = 141 Top = 127
Width = 28 Width = 26
BorderSpacing.Top = 4 BorderSpacing.Top = 4
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@@ -102,67 +122,67 @@ object BackRegFrm: TBackRegFrm
Spacing = 0 Spacing = 0
TabOrder = 5 TabOrder = 5
end end
object AllBtn: TBitBtn object AllBtn: TBitBtn[11]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = OutBtn AnchorSideTop.Control = OutBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 208 Left = 196
Height = 25 Height = 25
Top = 193 Top = 177
Width = 46 Width = 40
AutoSize = True AutoSize = True
BorderSpacing.Top = 24 BorderSpacing.Top = 24
Caption = 'ALL' Caption = 'All'
OnClick = AllBtnClick OnClick = AllBtnClick
Spacing = 0 Spacing = 0
TabOrder = 6 TabOrder = 6
end end
object SelList: TListBox object SelList: TListBox[12]
AnchorSideLeft.Control = AllBtn AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2 AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = GroupBox1 AnchorSideBottom.Control = OptionsGroup
Left = 262 Left = 240
Height = 118 Height = 84
Top = 126 Top = 114
Width = 193 Width = 192
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 4
BorderSpacing.Top = 2 BorderSpacing.Top = 2
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
ItemHeight = 0 ItemHeight = 0
MultiSelect = True MultiSelect = True
OnDblClick = SelListDblClick
OnSelectionChange = VarListSelectionChange OnSelectionChange = VarListSelectionChange
TabOrder = 7 TabOrder = 7
end end
object DepInBtn: TBitBtn object DepInBtn: TBitBtn[13]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = VarList AnchorSideTop.Control = VarList
Left = 217 Left = 203
Height = 28 Height = 26
Top = 25 Top = 17
Width = 28 Width = 26
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 1 ImageIndex = 1
OnClick = DepInBtnClick OnClick = DepInBtnClick
Spacing = 0 Spacing = 0
TabOrder = 1 TabOrder = 1
end end
object DepOutBtn: TBitBtn object DepOutBtn: TBitBtn[14]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = DepInBtn AnchorSideTop.Control = DepInBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 217 Left = 203
Height = 28 Height = 26
Top = 57 Top = 47
Width = 28 Width = 26
BorderSpacing.Top = 4 BorderSpacing.Top = 4
Images = MainDataModule.ImageList Images = MainDataModule.ImageList
ImageIndex = 0 ImageIndex = 0
@@ -170,38 +190,35 @@ object BackRegFrm: TBackRegFrm
Spacing = 0 Spacing = 0
TabOrder = 2 TabOrder = 2
end end
object DepVar: TEdit object DepVarEdit: TEdit[15]
AnchorSideLeft.Control = AllBtn AnchorSideLeft.Control = AllBtn
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label3 AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = ParamsPanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DepOutBtn AnchorSideBottom.Control = DepOutBtn
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 262 Left = 244
Height = 23 Height = 23
Top = 50 Top = 38
Width = 193 Width = 188
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 12 BorderSpacing.Bottom = 12
ReadOnly = True ReadOnly = True
TabOrder = 3 TabOrder = 3
Text = 'DepVar' Text = 'DepVarEdit'
end end
object GroupBox1: TGroupBox object OptionsGroup: TGroupBox[16]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = ParamsPanel
AnchorSideBottom.Control = Bevel1 AnchorSideBottom.Control = ButtonBevel
Left = 8 Left = 0
Height = 135 Height = 135
Top = 252 Top = 206
Width = 439 Width = 439
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Options' Caption = 'Options'
ChildSizing.LeftRightSpacing = 16 ChildSizing.LeftRightSpacing = 16
ChildSizing.TopBottomSpacing = 6 ChildSizing.TopBottomSpacing = 6
@@ -285,79 +302,16 @@ object BackRegFrm: TBackRegFrm
TabOrder = 8 TabOrder = 8
end end
end end
object ResetBtn: TButton
AnchorSideRight.Control = ComputeBtn
AnchorSideBottom.Control = Owner
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 inherited ParamsSplitter: TSplitter
AnchorSideRight.Control = CloseBtn Left = 444
AnchorSideBottom.Control = Owner Height = 398
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 end
object CloseBtn: TButton object OpenDialog1: TOpenDialog[2]
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.