diff --git a/applications/lazstats/source/LazStats.lpi b/applications/lazstats/source/LazStats.lpi
index 184b7184f..9f727883d 100644
--- a/applications/lazstats/source/LazStats.lpi
+++ b/applications/lazstats/source/LazStats.lpi
@@ -9,6 +9,7 @@
+
@@ -121,7 +122,7 @@
-
+
@@ -1517,6 +1518,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/applications/lazstats/source/LazStats.lpr b/applications/lazstats/source/LazStats.lpr
index f5503f6f3..4413f25c4 100644
--- a/applications/lazstats/source/LazStats.lpr
+++ b/applications/lazstats/source/LazStats.lpr
@@ -7,8 +7,9 @@ uses
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
- Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg,
- Globals, LicenseUnit, OptionsUnit, MainDM, MainUnit;
+ Forms, tachartlazaruspkg, tachartprint, lhelpcontrolpkg, Globals, LicenseUnit,
+ OptionsUnit, MainDM, MainUnit, BasicStatsReportFromUnit,
+BasicStatsReportAndChartFormUnit;
{$R LazStats.res}
@@ -28,6 +29,8 @@ begin
end;
Application.CreateForm(TMainDataModule, MainDataModule);
Application.CreateForm(TOS3MainFrm, OS3MainFrm);
+ Application.CreateForm(TBasicStatsReportAndChartForm,
+ BasicStatsReportAndChartForm);
Application.Run;
end.
diff --git a/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.lfm b/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.lfm
index 0b266db71..698570bf6 100644
--- a/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.lfm
+++ b/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.lfm
@@ -1,25 +1,27 @@
inherited GroupFreqForm: TGroupFreqForm
- Height = 212
+ Height = 279
+ Width = 673
Caption = 'Group Frequency Analysis'
- ClientHeight = 212
+ ClientHeight = 279
+ ClientWidth = 673
inherited ParamsPanel: TPanel
- Height = 196
- ClientHeight = 196
+ Height = 263
+ ClientHeight = 263
inherited CloseBtn: TButton
- Top = 171
+ Top = 238
end
inherited ComputeBtn: TButton
- Top = 171
+ Top = 238
end
inherited ResetBtn: TButton
- Top = 171
+ Top = 238
end
inherited HelpBtn: TButton
Tag = 162
- Top = 171
+ Top = 238
end
inherited ButtonBevel: TBevel
- Top = 155
+ Top = 222
end
object Label1: TLabel[5]
AnchorSideLeft.Control = ParamsPanel
@@ -38,7 +40,7 @@ inherited GroupFreqForm: TGroupFreqForm
AnchorSideRight.Control = GrpInBtn
AnchorSideBottom.Control = ButtonBevel
Left = 0
- Height = 138
+ Height = 205
Top = 17
Width = 126
Anchors = [akTop, akLeft, akRight, akBottom]
@@ -184,6 +186,6 @@ inherited GroupFreqForm: TGroupFreqForm
end
end
inherited ParamsSplitter: TSplitter
- Height = 212
+ Height = 279
end
end
diff --git a/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.pas b/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.pas
index 1eda00e8e..bb3266b4e 100644
--- a/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.pas
+++ b/applications/lazstats/source/forms/analysis/descriptive/groupfrequnit.pas
@@ -32,12 +32,12 @@ type
procedure VarListSelectionChange(Sender: TObject; User: boolean);
private
FLabelsSource: TListChartSource;
- procedure UpdateBtnStates;
protected
procedure AdjustConstraints; override;
procedure Compute; override;
procedure Plot(XLabels: StrDyneVec; FreqValues: DblDyneVec; XTitle: String);
+ procedure UpdateBtnStates; override;
public
constructor Create(AOwner: TComponent); override;
@@ -83,8 +83,8 @@ end;
procedure TGroupFreqForm.Compute;
-VAR
- nogroups, mingrp, maxgrp, grpcol, minfreq, maxfreq: integer;
+var
+ grpcol: integer;
cellStr: string;
i, numValues, valueIdx: integer;
freq: DblDyneVec = nil; // Could be IntDyneVec, but easier plotting with Dbl
@@ -97,7 +97,7 @@ begin
begin
grpcol := i;
break;
- end;
+ end;
if grpcol = 0 then
begin
MessageDlg('No variable selected.', mtError, [mbOK], 0);
@@ -243,21 +243,21 @@ procedure TGroupFreqForm.Reset;
var
i: integer;
begin
+ inherited;
+
VarList.Clear;
for i := 1 to NoVariables do
VarList.Items.Add(OS3MainFrm.DataGrid.Cells[i,0]);
GrpVarEdit.Text := '';
UpdateBtnStates;
-
- FChartFrame.Clear;
end;
procedure TGroupFreqForm.UpdateBtnStates;
begin
- GrpInBtn.Enabled := VarList.ItemIndex > -1;
+ inherited;
+ GrpInBtn.Enabled := (VarList.ItemIndex > -1);
GrpOutBtn.Enabled := (GrpVarEdit.Text <> '');
- FChartFrame.UpdateBtnStates;
end;
diff --git a/applications/lazstats/source/forms/misc/basicstatschartformunit.lfm b/applications/lazstats/source/forms/misc/basicstatschartformunit.lfm
index 7266ea254..e1c46c5ee 100644
--- a/applications/lazstats/source/forms/misc/basicstatschartformunit.lfm
+++ b/applications/lazstats/source/forms/misc/basicstatschartformunit.lfm
@@ -1,6 +1,5 @@
inherited BasicStatsChartForm: TBasicStatsChartForm
OnActivate = nil
- OnCreate = FormCreate
inherited ParamsPanel: TPanel
inherited CloseBtn: TButton
OnClick = CloseBtnClick
diff --git a/applications/lazstats/source/forms/misc/basicstatschartformunit.pas b/applications/lazstats/source/forms/misc/basicstatschartformunit.pas
index 27359ffd1..5e2410a3d 100644
--- a/applications/lazstats/source/forms/misc/basicstatschartformunit.pas
+++ b/applications/lazstats/source/forms/misc/basicstatschartformunit.pas
@@ -20,9 +20,11 @@ type
protected
FChartFrame: TChartFrame;
+ procedure UpdateBtnStates; override;
public
constructor Create(AOwner: TComponent); override;
+ procedure Reset; override;
end;
@@ -58,5 +60,21 @@ begin
Reset;
end;
+
+procedure TBasicStatsChartForm.Reset;
+begin
+ inherited;
+ if Assigned(FChartFrame) then
+ FChartFrame.Clear;
+end;
+
+
+procedure TBasicStatsChartForm.UpdateBtnStates;
+begin
+ inherited;
+ if Assigned(FChartFrame) then
+ FChartFrame.UpdateBtnStates;
+end;
+
end.
diff --git a/applications/lazstats/source/forms/misc/basicstatsparamsformunit.lfm b/applications/lazstats/source/forms/misc/basicstatsparamsformunit.lfm
index 05f571e00..ee58fa963 100644
--- a/applications/lazstats/source/forms/misc/basicstatsparamsformunit.lfm
+++ b/applications/lazstats/source/forms/misc/basicstatsparamsformunit.lfm
@@ -1,7 +1,5 @@
inherited BasicStatsParamsForm: TBasicStatsParamsForm
Caption = 'BasicStatsParamsForm'
- OnActivate = FormActivate
- OnCreate = FormCreate
Position = poMainFormCenter
object ParamsPanel: TPanel[0]
Left = 8
diff --git a/applications/lazstats/source/forms/misc/basicstatsparamsformunit.pas b/applications/lazstats/source/forms/misc/basicstatsparamsformunit.pas
index 597fa2da9..e441f487c 100644
--- a/applications/lazstats/source/forms/misc/basicstatsparamsformunit.pas
+++ b/applications/lazstats/source/forms/misc/basicstatsparamsformunit.pas
@@ -22,16 +22,17 @@ type
ParamsSplitter: TSplitter;
procedure CloseBtnClick(Sender: TObject);
procedure ComputeBtnClick(Sender: TObject);
- procedure FormActivate(Sender: TObject);
- procedure FormCreate(Sender: TObject);
procedure HelpBtnClick(Sender: TObject);
procedure ResetBtnClick(Sender: TObject);
private
protected
FAutoSized: Boolean;
+ procedure Activate; override;
procedure AdjustConstraints; virtual;
procedure Compute; virtual;
+ procedure InitForm;
+ procedure UpdateBtnStates; virtual;
function Validate(out AMsg: String; out AControl: TWinControl): Boolean; virtual;
public
@@ -49,7 +50,7 @@ implementation
uses
Math,
- Utils;
+ Globals, Utils;
{ TBasicStatsParamsForm }
@@ -57,6 +58,10 @@ uses
constructor TBasicStatsParamsForm.Create(AOwner: TComponent);
begin
inherited;
+
+ InitForm;
+ Reset;
+
CloseBtn.OnClick := @CloseBtnClick;
ComputeBtn.OnClick := @ComputeBtnClick;
ResetBtn.OnClick := @ResetBtnClick;
@@ -64,6 +69,29 @@ begin
end;
+procedure TBasicStatsParamsForm.Activate;
+var
+ w: Integer;
+begin
+ if FAutoSized then
+ exit;
+
+ w := MaxValue([HelpBtn.Width, ResetBtn.Width, ComputeBtn.Width, CloseBtn.Width]);
+ HelpBtn.Constraints.MinWidth := 2;
+ ResetBtn.Constraints.MinWidth := w;
+ ComputeBtn.Constraints.MinWidth := w;
+ CloseBtn.Constraints.MinWidth := w;
+
+ AdjustConstraints;
+
+ if Width < Constraints.MinWidth then Width := 1; // enforce constraints
+ if Height < Constraints.MinHeight then Height := 1;
+
+ Position := poDesigned;
+ FAutoSized := true;
+end;
+
+
procedure TBasicStatsParamsForm.AdjustConstraints;
begin
// be be overridden
@@ -98,34 +126,6 @@ begin
Compute;
end;
-procedure TBasicStatsParamsForm.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;
-
- AdjustConstraints;
-
- if Width < Constraints.MinWidth then Width := 1; // enforce constraints
- if Height < Constraints.MinHeight then Height := 1;
-
- Position := poDesigned;
- FAutoSized := true;
-end;
-
-
-procedure TBasicStatsParamsForm.FormCreate(Sender: TObject);
-begin
- InitForm(self);
- Reset;
-end;
-
procedure TBasicStatsParamsForm.HelpBtnClick(Sender: TObject);
begin
@@ -135,12 +135,26 @@ begin
end;
+procedure TBasicStatsParamsForm.InitForm;
+begin
+ Width := Scale96ToFont(DEFAULT_WIDTH);
+ Height := Scale96ToFont(DEFAULT_HEIGHT);
+ Position := poMainFormCenter;
+end;
+
+
procedure TBasicStatsParamsForm.ResetBtnClick(Sender: TObject);
begin
Reset;
end;
+procedure TBasicStatsParamsForm.UpdateBtnStates;
+begin
+ // to be overridden
+end;
+
+
function TBasicStatsParamsForm.Validate(out AMsg: String;
out AControl: TWinControl): Boolean;
begin
diff --git a/applications/lazstats/source/forms/misc/basicstatsreportandchartformunit.lfm b/applications/lazstats/source/forms/misc/basicstatsreportandchartformunit.lfm
new file mode 100644
index 000000000..ca53d3b30
--- /dev/null
+++ b/applications/lazstats/source/forms/misc/basicstatsreportandchartformunit.lfm
@@ -0,0 +1,22 @@
+inherited BasicStatsReportAndChartForm: TBasicStatsReportAndChartForm
+ object PageControl: TPageControl[2]
+ Left = 312
+ Height = 443
+ Top = 8
+ Width = 397
+ ActivePage = ReportPage
+ Align = alClient
+ BorderSpacing.Left = 4
+ BorderSpacing.Top = 8
+ BorderSpacing.Right = 8
+ BorderSpacing.Bottom = 8
+ TabIndex = 0
+ TabOrder = 2
+ object ReportPage: TTabSheet
+ Caption = 'Report'
+ end
+ object ChartPage: TTabSheet
+ Caption = 'Chart'
+ end
+ end
+end
diff --git a/applications/lazstats/source/forms/misc/basicstatsreportandchartformunit.pas b/applications/lazstats/source/forms/misc/basicstatsreportandchartformunit.pas
new file mode 100644
index 000000000..ff557fca3
--- /dev/null
+++ b/applications/lazstats/source/forms/misc/basicstatsreportandchartformunit.pas
@@ -0,0 +1,78 @@
+unit BasicStatsReportAndChartFormUnit;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, ExtCtrls,
+ StdCtrls, ReportFrameUnit, ChartFrameUnit, BasicStatsParamsFormUnit;
+
+type
+
+ { TBasicStatsReportAndChartForm }
+
+ TBasicStatsReportAndChartForm = class(TBasicStatsParamsForm)
+ PageControl: TPageControl;
+ ReportPage: TTabSheet;
+ ChartPage: TTabSheet;
+ private
+
+ protected
+ FReportFrame: TReportFrame;
+ FChartFrame: TChartFrame;
+ procedure UpdateBtnStates; override;
+
+ public
+ constructor Create(AOwner: TComponent); override;
+ procedure Reset; override;
+
+ end;
+
+var
+ BasicStatsReportAndChartForm: TBasicStatsReportAndChartForm;
+
+implementation
+
+{$R *.lfm}
+
+constructor TBasicStatsReportAndChartForm.Create(AOwner: TComponent);
+begin
+ inherited;
+
+ FReportFrame := TReportFrame.Create(self);
+ FReportFrame.Parent := ReportPage;
+ FReportFrame.Align := alClient;
+
+ FChartFrame := TChartFrame.Create(self);
+ FChartFrame.Parent := ChartPage;
+ FChartFrame.Align := alClient;
+ FChartFrame.Chart.BottomAxis.Intervals.MaxLength := 80;
+ FChartFrame.Chart.BottomAxis.Intervals.MinLength := 30;
+
+ Reset;
+end;
+
+
+procedure TBasicStatsReportAndChartForm.Reset;
+begin
+ inherited;
+ if Assigned(FReportFrame) then
+ FReportFrame.Clear;
+ if Assigned(FChartFrame) then
+ FChartFrame.Clear;
+end;
+
+
+procedure TBasicStatsReportAndChartForm.UpdateBtnStates;
+begin
+ inherited;
+ if Assigned(FReportFrame) then
+ FReportFrame.UpdateBtnStates;
+ if Assigned(FChartFrame) then
+ FChartFrame.UpdateBtnStates;
+end;
+
+
+end.
+
diff --git a/applications/lazstats/source/forms/misc/basicstatsreportfromunit.lfm b/applications/lazstats/source/forms/misc/basicstatsreportfromunit.lfm
new file mode 100644
index 000000000..4b4a46086
--- /dev/null
+++ b/applications/lazstats/source/forms/misc/basicstatsreportfromunit.lfm
@@ -0,0 +1,4 @@
+inherited BasicStatsReportForm: TBasicStatsReportForm
+ Caption = 'BasicStatsReportForm'
+ OnCreate = FormCreate
+end
diff --git a/applications/lazstats/source/forms/misc/basicstatsreportfromunit.pas b/applications/lazstats/source/forms/misc/basicstatsreportfromunit.pas
new file mode 100644
index 000000000..d6f53ddfd
--- /dev/null
+++ b/applications/lazstats/source/forms/misc/basicstatsreportfromunit.pas
@@ -0,0 +1,73 @@
+unit BasicStatsReportFromUnit;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, Forms, Controls, Graphics, Dialogs,
+ ReportFrameUnit, BasicStatsParamsFormUnit;
+
+type
+
+ { TBasicStatsReportForm }
+
+ TBasicStatsReportForm = class(TBasicStatsParamsForm)
+ private
+
+ protected
+ FReportFrame: TReportFrame;
+ procedure UpdateBtnStates; override;
+
+ public
+ constructor Create(AOwner: TComponent); override;
+ procedure Reset; override;
+
+ end;
+
+var
+ BasicStatsReportForm: TBasicStatsReportForm;
+
+implementation
+
+{$R *.lfm}
+
+uses
+ Utils;
+
+constructor TBasicStatsReportForm.Create(AOwner: TComponent);
+begin
+ inherited;
+
+ FReportFrame := TReportFrame.Create(self);
+ FReportFrame.Parent := Self;
+ FReportFrame.Align := alClient;
+ FReportFrame.BorderSpacing.Left := 4;
+ FReportFrame.BorderSpacing.Top := 8;
+ FReportFrame.BorderSpacing.Bottom := 8;
+ FReportFrame.BorderSpacing.Right := 8;
+
+ InitToolbar(FReportFrame.ReportToolbar, tpRight);
+
+ Reset;
+end;
+
+
+procedure TBasicStatsReportForm.Reset;
+begin
+ inherited;
+ if Assigned(FReportFrame) then
+ FReportFrame.Clear;
+end;
+
+
+procedure TBasicStatsReportForm.UpdateBtnStates;
+begin
+ inherited;
+ if Assigned(FReportFrame) then
+ FReportFrame.UpdateBtnStates;
+end;
+
+
+end.
+