unit statu;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons;

type
  TStatForm = class(TForm)
    lblPuzz: TLabel;
    lblSolv: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure SetStats(vPuzz, vSolv : Integer);
    procedure SetPlace(pLeft, pTop, pWidth : Integer);
  end;

var
  StatForm: TStatForm;

implementation
uses IniFiles, ladSharU;
{$R *.DFM}

procedure TStatForm.SetStats(vPuzz, vSolv : Integer);
begin
  lblPuzz.Caption := Format('%d puzzles total', [vPuzz]);
  lblSolv.Caption := Format('%d puzzles solved', [vSolv]);
end;

procedure TStatForm.SetPlace(pLeft, pTop, pWidth : Integer);
begin
  Top := pTop;
  Left := pLeft + pWidth;
  IF Left + Width > Screen.Width THEN
    Left := pLeft - Width;
end;

procedure TStatForm.BitBtn2Click(Sender: TObject);
begin
  WITH TIniFile.Create(IniName) DO
    try
      EraseSection('Solved');
    finally
      Free;
    end;
  lblSolv.Caption := '0 puzzles solved';
end;

end.

