LazStats: Beginning to inherited forms from TBasicStatsForm. Add ResetForms method to Mainform in order to reset all non-modal data forms, eg. when a new file is loaded.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7701 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-09-27 17:59:39 +00:00
parent eeda26f714
commit 4867231421
24 changed files with 140 additions and 498 deletions

View File

@@ -49,7 +49,7 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item7> </Item7>
</RequiredPackages> </RequiredPackages>
<Units Count="176"> <Units Count="177">
<Unit0> <Unit0>
<Filename Value="LazStats.lpr"/> <Filename Value="LazStats.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@@ -1429,6 +1429,13 @@
<ResourceBaseClass Value="Frame"/> <ResourceBaseClass Value="Frame"/>
<UnitName Value="ReportFrameUnit"/> <UnitName Value="ReportFrameUnit"/>
</Unit175> </Unit175>
<Unit176>
<Filename Value="forms\misc\basicstatsformunit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="BasicStatsForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="BasicStatsFormUnit"/>
</Unit176>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@@ -8,7 +8,8 @@ uses
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg,
Globals, LicenseUnit, OptionsUnit, MainDM, MainUnit, ReportFrameUnit; Globals, LicenseUnit, OptionsUnit, MainDM, MainUnit, ReportFrameUnit,
BasicStatsFormUnit;
{$R LazStats.res} {$R LazStats.res}
@@ -28,6 +29,7 @@ begin
end; end;
Application.CreateForm(TMainDataModule, MainDataModule); Application.CreateForm(TMainDataModule, MainDataModule);
Application.CreateForm(TOS3MainFrm, OS3MainFrm); Application.CreateForm(TOS3MainFrm, OS3MainFrm);
Application.CreateForm(TBasicStatsForm, BasicStatsForm);
Application.Run; Application.Run;
end. end.

View File

@@ -1,4 +1,4 @@
object BoxPlotFrm: TBoxPlotFrm inherited BoxPlotFrm: TBoxPlotFrm
Left = 449 Left = 449
Height = 500 Height = 500
Top = 211 Top = 211

View File

@@ -9,14 +9,15 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Printers, ComCtrls, Buttons, StdCtrls, ExtCtrls, Printers, ComCtrls, Buttons,
MainUnit, Globals, DataProcs, ContextHelpUnit, ReportFrameUnit, ChartFrameUnit; MainUnit, Globals, DataProcs, ContextHelpUnit,
BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit;
type type
{ TBoxPlotFrm } { TBoxPlotFrm }
TBoxPlotFrm = class(TForm) TBoxPlotFrm = class(TBasicStatsForm)
Bevel2: TBevel; Bevel2: TBevel;
HelpBtn: TButton; HelpBtn: TButton;
PageControl1: TPageControl; PageControl1: TPageControl;
@@ -62,7 +63,7 @@ type
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var

View File

@@ -9,14 +9,15 @@ interface
uses uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, Clipbrd, Buttons, ExtCtrls, ComCtrls, Math, StdCtrls, Clipbrd, Buttons, ExtCtrls, ComCtrls, Math,
MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit, ChartFrameUnit, ReportFrameUnit; MainUnit, Globals, DataProcs, DictionaryUnit, ContextHelpUnit,
BasicStatsFormUnit, ChartFrameUnit, ReportFrameUnit;
type type
{ TBubbleForm } { TBubbleForm }
TBubbleForm = class(TForm) TBubbleForm = class(TBasicStatsForm)
Bevel1: TBevel; Bevel1: TBevel;
HelpBtn: TButton; HelpBtn: TButton;
PageControl: TPageControl; PageControl: TPageControl;
@@ -79,7 +80,7 @@ type
procedure UpdateBtnStates; procedure UpdateBtnStates;
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var

View File

@@ -1,4 +1,4 @@
object DescriptiveFrm: TDescriptiveFrm inherited DescriptiveFrm: TDescriptiveFrm
Left = 526 Left = 526
Height = 384 Height = 384
Top = 202 Top = 202

View File

@@ -7,14 +7,15 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Buttons, StdCtrls, ExtCtrls, Buttons,
MainUnit, Globals, FunctionsLib, ReportFrameUnit, DataProcs, DictionaryUnit, ContextHelpUnit; MainUnit, Globals, FunctionsLib, BasicStatsFormUnit,
ReportFrameUnit, DataProcs, DictionaryUnit, ContextHelpUnit;
type type
{ TDescriptiveFrm } { TDescriptiveFrm }
TDescriptiveFrm = class(TForm) TDescriptiveFrm = class(TBasicStatsForm)
Bevel1: TBevel; Bevel1: TBevel;
ComputeBtn: TButton; ComputeBtn: TButton;
CaseChk: TCheckBox; CaseChk: TCheckBox;
@@ -60,7 +61,7 @@ type
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var

View File

@@ -1,266 +0,0 @@
object FreqSpecsFrm: TFreqSpecsFrm
Left = 310
Height = 331
Top = 137
Width = 325
AutoSize = True
BorderStyle = bsSingle
Caption = 'Frequency Specifications'
ClientHeight = 331
ClientWidth = 325
OnActivate = FormActivate
Position = poMainFormCenter
LCLVersion = '2.1.0.0'
object Label1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = VarName
AnchorSideTop.Side = asrCenter
Left = 8
Height = 15
Top = 84
Width = 44
BorderSpacing.Left = 8
Caption = 'Variable:'
ParentColor = False
end
object Label2: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Minimum
AnchorSideTop.Side = asrCenter
Left = 8
Height = 15
Top = 115
Width = 53
BorderSpacing.Left = 8
Caption = 'Minimum'
ParentColor = False
end
object Label3: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Maximum
AnchorSideTop.Side = asrCenter
Left = 8
Height = 15
Top = 146
Width = 55
BorderSpacing.Left = 8
Caption = 'Maximum'
ParentColor = False
end
object Label4: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Range
AnchorSideTop.Side = asrCenter
Left = 8
Height = 15
Top = 177
Width = 33
BorderSpacing.Left = 8
Caption = 'Range'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = IntSize
AnchorSideTop.Side = asrCenter
Left = 8
Height = 15
Top = 208
Width = 62
BorderSpacing.Left = 8
Caption = 'Interval Size'
ParentColor = False
end
object Label6: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = NoInts
AnchorSideTop.Side = asrCenter
Left = 8
Height = 15
Top = 239
Width = 105
BorderSpacing.Left = 8
Caption = 'Number of Intervals'
ParentColor = False
end
object VarName: TEdit
AnchorSideLeft.Control = NoInts
AnchorSideTop.Control = Memo1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 137
Height = 23
Top = 80
Width = 180
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 12
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 0
end
object Minimum: TEdit
AnchorSideLeft.Control = NoInts
AnchorSideTop.Control = VarName
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 137
Height = 23
Top = 111
Width = 180
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 1
end
object Maximum: TEdit
AnchorSideLeft.Control = NoInts
AnchorSideTop.Control = Minimum
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 137
Height = 23
Top = 142
Width = 180
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 2
end
object Range: TEdit
AnchorSideLeft.Control = NoInts
AnchorSideTop.Control = Maximum
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 137
Height = 23
Top = 173
Width = 180
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
ReadOnly = True
TabOrder = 3
end
object IntSize: TEdit
AnchorSideLeft.Control = NoInts
AnchorSideTop.Control = Range
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 137
Height = 23
Top = 204
Width = 180
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
BorderSpacing.Right = 8
OnKeyPress = IntSizeKeyPress
TabOrder = 4
end
object NoInts: TEdit
AnchorSideLeft.Control = Label6
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = IntSize
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 137
Height = 23
Top = 235
Width = 180
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 24
BorderSpacing.Top = 8
BorderSpacing.Right = 8
TabOrder = 5
end
object CancelBtn: TButton
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = OKBtn
Left = 201
Height = 25
Top = 274
Width = 62
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Cancel'
ModalResult = 2
TabOrder = 7
end
object OKBtn: TButton
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 275
Height = 25
Top = 274
Width = 42
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
Caption = 'OK'
ModalResult = 1
OnClick = OKBtnClick
TabOrder = 8
end
object HelpBtn: TButton
Tag = 123
AnchorSideTop.Control = Bevel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CancelBtn
Left = 138
Height = 25
Top = 274
Width = 51
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 36
BorderSpacing.Top = 8
BorderSpacing.Right = 12
BorderSpacing.Bottom = 8
Caption = 'Help'
OnClick = HelpBtnClick
TabOrder = 6
end
object Bevel1: TBevel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = NoInts
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 8
Top = 258
Width = 325
Anchors = [akTop, akLeft, akRight]
Shape = bsBottomLine
end
object Memo1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 8
Height = 60
Top = 8
Width = 309
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 8
Caption = 'The number of intervals must be less than or equal to the number of cases. To change the number of intervals, change the interval size to a larger value. Press the Enter key to make the number of intervals smaller.'
ParentColor = False
WordWrap = True
end
end

View File

@@ -1,149 +0,0 @@
unit FreqSpecsUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls,
ContextHelpUnit;
type
{ TFreqSpecsFrm }
TFreqSpecsFrm = class(TForm)
Bevel1: TBevel;
CancelBtn: TButton;
HelpBtn: TButton;
Memo1: TLabel;
OKBtn: TButton;
VarName: TEdit;
Minimum: TEdit;
Maximum: TEdit;
Range: TEdit;
IntSize: TEdit;
NoInts: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure FormActivate(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure IntSizeKeyPress(Sender: TObject; var Key: char);
procedure OKBtnClick(Sender: TObject);
private
{ private declarations }
FAutoSized: Boolean;
FNoCases: Integer;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean;
public
{ public declarations }
property NoCases: Integer read FNoCases write FNoCases;
end;
var
FreqSpecsFrm: TFreqSpecsFrm;
implementation
uses
Math;
{ TFreqSpecsFrm }
procedure TFreqSpecsFrm.IntSizeKeyPress(Sender: TObject; var Key: char);
var
rangeval : double;
increment : double;
begin
if ord(Key) <> 13 then exit;
rangeval := StrToFloat(Range.Text);
increment := StrToFloat(IntSize.Text);
NoInts.Text := FloatToStr(rangeval / increment);
end;
procedure TFreqSpecsFrm.OKBtnClick(Sender: TObject);
var
msg: String;
C: TWinControl;
begin
if not Validate(msg, C) then begin
C.SetFocus;
MessageDlg(msg, mtError, [mbOK], 0);
ModalResult := mrNone;
end;
end;
function TFreqSpecsFrm.Validate(out AMsg: String;
out AControl: TWinControl): Boolean;
var
NoIntervals: Integer;
f: Double;
begin
Result := False;
if IntSize.Text = '' then
begin
AControl := IntSize;
AMsg := 'Interval size is not specified.';
exit;
end;
if not TryStrToFloat(IntSize.Text, f) then
begin
AControl := IntSize;
AMsg := 'No valid number given for interval size.';
exit;
end;
if NoInts.Text = '' then
begin
AControl := NoInts;
AMsg := 'Number of intervals not specified.';
exit;
end;
if not TryStrToInt(NoInts.Text, NoIntervals) then
begin
AControl := NoInts;
AMsg := 'No valid number given for number of intervals.';
exit;
end;
if NoIntervals + 1 > NoCases then begin
AControl := NoInts;
AMsg := Format('Number of intervals cannot be greater than the number of cases (%d).', [NoCases]);
exit;
end;
Result := true;
end;
procedure TFreqSpecsFrm.FormActivate(Sender: TObject);
var
w: Integer;
begin
if FAutoSized then
exit;
w := MaxValue([OKBtn.Width, CancelBtn.Width, HelpBtn.Width]);
OKBtn.Constraints.MinWidth := w;
CancelBtn.Constraints.MinWidth := w;
HelpBtn.Constraints.MinWidth := w;
Constraints.MinHeight := Height;
Constraints.MaxHeight := Height;
HelpBtn.BorderSpacing.Left := NoInts.Left;
FAutoSized := true;
end;
procedure TFreqSpecsFrm.HelpBtnClick(Sender: TObject);
begin
if ContextHelpForm = nil then
Application.CreateForm(TContextHelpForm, ContextHelpForm);
ContextHelpForm.HelpMessage((Sender as TButton).tag);
end;
initialization
{$I freqspecsunit.lrs}
end.

View File

@@ -1,4 +1,4 @@
object FreqFrm: TFreqFrm inherited FreqFrm: TFreqFrm
Left = 490 Left = 490
Height = 376 Height = 376
Top = 228 Top = 228

View File

@@ -9,13 +9,13 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin, StdCtrls, Buttons, ExtCtrls, ComCtrls, Spin,
Globals, MainUnit, GraphLib, DataProcs, ReportFrameUnit, ChartFrameUnit; Globals, MainUnit, GraphLib, DataProcs, BasicStatsFormUnit, ReportFrameUnit, ChartFrameUnit;
type type
{ TFreqFrm } { TFreqFrm }
TFreqFrm = class(TForm) TFreqFrm = class(TBasicStatsForm)
Bevel1: TBevel; Bevel1: TBevel;
BinSelectionGroup: TGroupBox; BinSelectionGroup: TGroupBox;
ThreeDChk: TCheckBox; ThreeDChk: TCheckBox;
@@ -70,7 +70,7 @@ type
procedure UpdateBtnStates; procedure UpdateBtnStates;
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var

View File

@@ -1,4 +1,4 @@
object MultXvsYFrm: TMultXvsYFrm inherited MultXvsYFrm: TMultXvsYFrm
Left = 814 Left = 814
Height = 416 Height = 416
Top = 216 Top = 216

View File

@@ -10,13 +10,14 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Buttons, Clipbrd, StdCtrls, ExtCtrls, Buttons, Clipbrd,
MainUnit, Globals, OutputUnit, DataProcs, DictionaryUnit, ContextHelpUnit; MainUnit, Globals, OutputUnit, DataProcs, DictionaryUnit, ContextHelpUnit,
BasicStatsFormUnit;
type type
{ TMultXvsYFrm } { TMultXvsYFrm }
TMultXvsYFrm = class(TForm) TMultXvsYFrm = class(TBasicStatsForm)
Bevel1: TBevel; Bevel1: TBevel;
HelpBtn: TButton; HelpBtn: TButton;
Panel1: TPanel; Panel1: TPanel;
@@ -71,7 +72,7 @@ type
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var

View File

@@ -1,4 +1,4 @@
object NormalityFrm: TNormalityFrm inherited NormalityFrm: TNormalityFrm
Left = 628 Left = 628
Height = 516 Height = 516
Top = 275 Top = 275

View File

@@ -9,14 +9,15 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, ComCtrls, StdCtrls, Buttons, ExtCtrls, ComCtrls,
MainUnit, Globals, FunctionsLib, DataProcs, ReportFrameUnit, ChartFrameUnit; MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsFormUnit,
ReportFrameUnit, ChartFrameUnit;
type type
{ TNormalityFrm } { TNormalityFrm }
TNormalityFrm = class(TForm) TNormalityFrm = class(TBasicStatsForm)
Bevel1: TBevel; Bevel1: TBevel;
PageControl: TPageControl; PageControl: TPageControl;
ParamsPanel: TPanel; ParamsPanel: TPanel;
@@ -56,7 +57,7 @@ type
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var
@@ -467,6 +468,8 @@ begin
VarList.Items.Clear; VarList.Items.Clear;
for i := 1 to NoVariables do for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]); VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
FReportFrame.Clear;
FChartFrame.Clear;
UpdateBtnStates; UpdateBtnStates;
end; end;

View File

@@ -1,4 +1,4 @@
object PlotXYFrm: TPlotXYFrm inherited PlotXYFrm: TPlotXYFrm
Left = 427 Left = 427
Height = 500 Height = 500
Top = 175 Top = 175

View File

@@ -9,13 +9,14 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, Buttons, ComCtrls, StdCtrls, ExtCtrls, Buttons, ComCtrls,
MainUnit, Globals, FunctionsLib, DataProcs, ReportFrameUnit, ChartFrameUnit; MainUnit, Globals, FunctionsLib, DataProcs, BasicStatsFormUnit,
ReportFrameUnit, ChartFrameUnit;
type type
{ TPlotXYFrm } { TPlotXYFrm }
TPlotXYFrm = class(TForm) TPlotXYFrm = class(TBasicStatsForm)
Bevel1: TBevel; Bevel1: TBevel;
ConfEdit: TEdit; ConfEdit: TEdit;
Label4: TLabel; Label4: TLabel;
@@ -64,7 +65,7 @@ type
Xcol,Ycol: Integer): Boolean; Xcol,Ycol: Integer): Boolean;
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var

View File

@@ -1,4 +1,4 @@
object XvsMultYForm: TXvsMultYForm inherited XvsMultYForm: TXvsMultYForm
Left = 288 Left = 288
Height = 500 Height = 500
Top = 117 Top = 117

View File

@@ -9,14 +9,14 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls, StdCtrls, Buttons, ExtCtrls, Printers, ComCtrls,
MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, MainUnit, Globals, ContextHelpUnit, DataProcs, MatrixLib, BasicStatsFormUnit,
ReportFrameUnit, ChartFrameUnit; ReportFrameUnit, ChartFrameUnit;
type type
{ TXvsMultYForm } { TXvsMultYForm }
TXvsMultYForm = class(TForm) TXvsMultYForm = class(TBasicStatsForm)
Bevel2: TBevel; Bevel2: TBevel;
LinesBox: TCheckBox; LinesBox: TCheckBox;
GroupBox1: TGroupBox; GroupBox1: TGroupBox;
@@ -64,7 +64,7 @@ type
procedure UpdateBtnStates; procedure UpdateBtnStates;
public public
{ public declarations } { public declarations }
procedure Reset; procedure Reset; override;
end; end;
var var

View File

@@ -232,7 +232,9 @@ object OS3MainFrm: TOS3MainFrm
TitleFont.Name = 'Courier New' TitleFont.Name = 'Courier New'
TitleFont.Pitch = fpFixed TitleFont.Pitch = fpFixed
TitleFont.Quality = fqDraft TitleFont.Quality = fqDraft
OnCellProcess = DataGridCellProcess
OnClick = DataGridClick OnClick = DataGridClick
OnEditingDone = DataGridEditingDone
OnKeyDown = DataGridKeyDown OnKeyDown = DataGridKeyDown
OnKeyPress = DataGridKeyPress OnKeyPress = DataGridKeyPress
OnPrepareCanvas = DataGridPrepareCanvas OnPrepareCanvas = DataGridPrepareCanvas

View File

@@ -21,7 +21,7 @@ unit MainUnit;
interface interface
uses uses
LCLType, Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, LCLType, Classes, SysUtils, FileUtil, Forms, Controls, Graphics,
Dialogs, Menus, ExtCtrls, StdCtrls, Grids, Dialogs, Menus, ExtCtrls, StdCtrls, Grids,
{$IFDEF USE_EXTERNAL_HELP_VIEWER} {$IFDEF USE_EXTERNAL_HELP_VIEWER}
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
@@ -285,6 +285,9 @@ type
DataGrid: TStringGrid; DataGrid: TStringGrid;
// Form event handlers // Form event handlers
procedure DataGridCellProcess(Sender: TObject; aCol, aRow: Integer;
processType: TCellProcessType; var aValue: string);
procedure DataGridEditingDone(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
@@ -492,6 +495,7 @@ type
LHelpConnector: TLHelpConnector; LHelpConnector: TLHelpConnector;
{$ENDIF} {$ENDIF}
procedure Init; procedure Init;
procedure ResetForms;
public public
{ public declarations } { public declarations }
end; end;
@@ -503,8 +507,11 @@ var
implementation implementation
{$R *.lfm}
uses uses
Utils, OptionsUnit, OutputUnit, LicenseUnit, TransFrmUnit, DescriptiveUnit, Utils, BasicStatsFormUnit,
OptionsUnit, OutputUnit, LicenseUnit, TransFrmUnit, DescriptiveUnit,
FreqUnit, CrossTabUnit, BreakDownUnit, BoxPlotUnit, NormalityUnit, Rot3DUnit, FreqUnit, CrossTabUnit, BreakDownUnit, BoxPlotUnit, NormalityUnit, Rot3DUnit,
PlotXYUnit, BubblePlotUnit, StemLeafUnit, MultXvsYUnit, OneSampUnit, PlotXYUnit, BubblePlotUnit, StemLeafUnit, MultXvsYUnit, OneSampUnit,
TwoCorrsUnit, TwoPropUnit, TtestUnit, BlkAnovaUnit, WithinANOVAUnit, TwoCorrsUnit, TwoPropUnit, TtestUnit, BlkAnovaUnit, WithinANOVAUnit,
@@ -548,6 +555,18 @@ begin
CanClose := (res = mrYes); CanClose := (res = mrYes);
end; end;
procedure TOS3MainFrm.DataGridEditingDone(Sender: TObject);
begin
ResetForms;
end;
procedure TOS3MainFrm.DataGridCellProcess(Sender: TObject; aCol, aRow: Integer;
processType: TCellProcessType; var aValue: string);
begin
if ProcessType = cpPaste then
ResetForms;
end;
procedure TOS3MainFrm.FormCreate(Sender: TObject); procedure TOS3MainFrm.FormCreate(Sender: TObject);
var var
helpfn: String; helpfn: String;
@@ -1243,6 +1262,8 @@ begin
NoVarsEdit.Text := IntToStr(DataGrid.ColCount-1); NoVarsEdit.Text := IntToStr(DataGrid.ColCount-1);
NoCasesEdit.Text := IntToStr(DataGrid.RowCount-1); NoCasesEdit.Text := IntToStr(DataGrid.RowCount-1);
ResetForms;
end; end;
// Menu "Edit" > "Copy Block of Cells" // Menu "Edit" > "Copy Block of Cells"
@@ -1342,76 +1363,45 @@ end;
procedure TOS3MainFrm.mnuFileImportCSVClick(Sender: TObject); procedure TOS3MainFrm.mnuFileImportCSVClick(Sender: TObject);
begin begin
OpenCommaFile; OpenCommaFile;
ResetForms;
end; end;
// Menu "File" > "Import" > "SPACE File" // Menu "File" > "Import" > "SPACE File"
procedure TOS3MainFrm.mnuFileImportSSVClick(Sender: TObject); procedure TOS3MainFrm.mnuFileImportSSVClick(Sender: TObject);
begin begin
OpenSpaceFile; OpenSpaceFile;
ResetForms;
end; end;
// Menu "File" > "Import" > "TAB File" // Menu "File" > "Import" > "TAB File"
procedure TOS3MainFrm.mnuFileImportTABClick(Sender: TObject); procedure TOS3MainFrm.mnuFileImportTABClick(Sender: TObject);
begin begin
OpenTabFile; OpenTabFile;
ResetForms;
end; end;
// Menu "File" > "New" // Menu "File" > "New"
procedure TOS3MainFrm.mnuFileNewClick(Sender: TObject); procedure TOS3MainFrm.mnuFileNewClick(Sender: TObject);
begin begin
ClearGrid; ClearGrid;
ResetForms;
end; end;
// Menu "File" > "Open" // Menu "File" > "Open"
procedure TOS3MainFrm.mnuFileOpenClick(Sender: TObject); procedure TOS3MainFrm.mnuFileOpenClick(Sender: TObject);
{
var
i : integer;
filename : string;
}
begin begin
OpenOS2File; if OpenOS2File then
begin
SaveOptions; SaveOptions;
(* ResetForms;
filename := FileNameEdit.Text;
// move all down 1 and add new one at the top
{ for i := 8 downto 1 do
begin
MainMenu.Items[0].Items[11].Items[i].Caption :=
MainMenu.Items[0].Items[11].Items[i-1].Caption;
MainMenu.Items[0].Items[11].Items[i-1].Caption := ' ';
end; end;
MainMenu.Items[0].Items[11].Items[0].Caption := filename;}
if OptionsFrm = nil then
Application.CreateForm(TOptionsFrm, OptionsFrm);
OptionsFrm.SaveBtnClick(Self);
*)
end; end;
// Menu "File" > "Save" // Menu "File" > "Save"
procedure TOS3MainFrm.mnuFileSaveClick(Sender: TObject); procedure TOS3MainFrm.mnuFileSaveClick(Sender: TObject);
(*
var
i : integer;
filename : string;
*)
begin begin
SaveOS2File; SaveOS2File;
SaveOptions; SaveOptions;
(*
filename := FileNameEdit.Text;
// move all down 1 and add new one at the top
{ for i := 8 downto 1 do
begin
MainMenu.Items[0].Items[11].Items[i].Caption :=
MainMenu.Items[0].Items[11].Items[i-1].Caption;
MainMenu.Items[0].Items[11].Items[i-1].Caption := ' ';
end;
MainMenu.Items[0].Items[11].Items[0].Caption := filename;}
if OptionsFrm = nil then
Application.CreateForm(TOptionsFrm, OptionsFrm);
OptionsFrm.SaveBtnClick(Self);
*)
end; end;
// Menu "Help" > "About" // Menu "Help" > "About"
@@ -2209,10 +2199,15 @@ begin
end; end;
procedure TOS3MainFrm.ResetForms;
var
i: Integer;
begin
for i := 0 to Screen.FormCount-1 do
if Screen.Forms[i] is TBasicStatsForm then
TBasicStatsForm(Screen.Forms[i]).Reset;
end;
initialization
{$I mainunit.lrs}
end. end.

View File

@@ -0,0 +1,8 @@
object BasicStatsForm: TBasicStatsForm
Left = 519
Height = 459
Top = 260
Width = 717
Caption = 'BasicStatsForm'
LCLVersion = '2.1.0.0'
end

View File

@@ -0,0 +1,32 @@
unit BasicStatsFormUnit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs;
type
TBasicStatsForm = class(TForm)
private
public
procedure Reset; virtual;
end;
var
BasicStatsForm: TBasicStatsForm;
implementation
{$R *.lfm}
procedure TBasicStatsForm.Reset;
begin
// to be overridden
end;
end.

View File

@@ -15,8 +15,8 @@ procedure FormatGrid;
function IsNumeric(s : string) : boolean; function IsNumeric(s : string) : boolean;
procedure VecPrint(vector: IntDyneVec; Size: integer; Heading: string; AReport: TStrings); procedure VecPrint(vector: IntDyneVec; Size: integer; Heading: string; AReport: TStrings);
procedure SaveOS2File; procedure SaveOS2File;
procedure OpenOS2File; function OpenOS2File: Boolean;
procedure OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean); function OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean): Boolean;
procedure DeleteCol; procedure DeleteCol;
procedure CopyColumn; procedure CopyColumn;
procedure PasteColumn; procedure PasteColumn;
@@ -276,8 +276,9 @@ begin
end; end;
//------------------------------------------------------------------- //-------------------------------------------------------------------
procedure OpenOS2File; function OpenOS2File: Boolean;
begin begin
Result := false;
with OS3MainFrm.OpenDialog do with OS3MainFrm.OpenDialog do
begin begin
DefaultExt := '.laz'; DefaultExt := '.laz';
@@ -286,19 +287,20 @@ begin
InitialDir := Globals.Options.DefaultDataPath; InitialDir := Globals.Options.DefaultDataPath;
FilterIndex := 1; FilterIndex := 1;
if Execute then begin if Execute then begin
OpenOS2File(FileName, true); Result := OpenOS2File(FileName, true);
InitialDir := ExtractFilePath(FileName); InitialDir := ExtractFilePath(FileName);
end; end;
end; end;
end; end;
procedure OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean); function OpenOS2File(const AFileName: String; ShowDictionaryForm: Boolean): Boolean;
var var
F: TextFile; F: TextFile;
s: string; s: string;
i, j: integer; i, j: integer;
NRows, NCols: integer; NRows, NCols: integer;
begin begin
Result := false;
if Lowercase(ExtractFileExt(AFileName)) <> '.laz' then if Lowercase(ExtractFileExt(AFileName)) <> '.laz' then
begin begin
MessageDlg(Format('"%s" is not a .laz file.', [AFileName]), mtError, [mbOK], 0); MessageDlg(Format('"%s" is not a .laz file.', [AFileName]), mtError, [mbOK], 0);
@@ -374,6 +376,7 @@ begin
if ShowDictionaryForm then if ShowDictionaryForm then
DictionaryFrm.ShowModal; DictionaryFrm.ShowModal;
FormatGrid; FormatGrid;
Result := true;
end; end;
//------------------------------------------------------------------- //-------------------------------------------------------------------