home *** CD-ROM | disk | FTP | other *** search
- unit Aboutdlg;
-
- interface
-
- uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, StdCtrls,
- Buttons, ExtCtrls, Spin, SysUtils, IniFiles;
-
- type
- TdlgAboutBox = class(TForm)
- Panel1: TPanel;
- OKButton: TBitBtn;
- ProgramIcon: TImage;
- ProductName: TLabel;
- Version: TLabel;
- Copyright: TLabel;
- Comments: TLabel;
- GroupBox1: TGroupBox;
- spnedtWidth: TSpinEdit;
- chckboxFormatResult: TCheckBox;
- lblWidth: TLabel;
- btnSave: TButton;
- spnedtNumOfDecs: TSpinEdit;
- lblNumOfDecs: TLabel;
- procedure chckboxFormatResultClick(Sender: TObject);
- procedure btnSaveClick(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- dlgAboutBox: TdlgAboutBox;
-
- implementation
-
- {$R *.DFM}
-
- uses CCalcDlg;
-
- var
- Ini : TIniFile;
-
- procedure TdlgAboutBox.chckboxFormatResultClick(Sender: TObject);
- begin
- if chckboxFormatResult.state = cbChecked then
- begin
- spnedtWidth.Enabled := true;
- lblWidth.Font.Color := clBlack;
- lblNumOfDecs.Font.Color := clBlack;
- spnedtNumOfDecs.Enabled := true;
- end
- else
- begin
- spnedtWidth.Enabled := false;
- lblWidth.Font.Color := clGray;
- lblNumOfDecs.Font.Color := clGray;
- spnedtNumOfDecs.Enabled := false;
- end;
- end;
-
- procedure TdlgAboutBox.btnSaveClick(Sender: TObject);
- var
- Ini : TIniFile;
- begin
- Ini := TIniFile.Create('CoolCalc.INI');
- if chckboxFormatResult.State = cbChecked then
- Ini.writeBool('Calculator Options', 'Format Result', true)
- else
- Ini.writeBool('Calculator Options', 'Format Result', false);
- Ini.writeInteger('Calculator Options', 'Width', spnedtWidth.value);
- Ini.writeInteger('Calculator Options', 'Number Of Decimals', spnedtNumOfDecs.value);
- Ini.Free;
- end;
-
- procedure TdlgAboutBox.FormCreate(Sender: TObject);
- begin
- if CCalcDlg.vbFormatResult then
- begin
- chckboxFormatResult.State := cbChecked;
- spnedtWidth.Enabled := true;
- lblWidth.Font.Color := clBlack;
- lblNumOfDecs.Font.Color := clBlack;
- spnedtNumOfDecs.Enabled := true;
- end
- else
- begin
- chckboxFormatResult.State := cbUnchecked;
- spnedtWidth.Enabled := false;
- lblWidth.Font.Color := clGray;
- lblNumOfDecs.Font.Color := clGray;
- spnedtNumOfDecs.Enabled := false;
- end;
- spnedtWidth.value := CCalcDlg.vlWidth;
- spnedtNumOfDecs.value := CCalcDlg.vlNumOfDecs;
- end;
-
- procedure TdlgAboutBox.FormClose(Sender: TObject;
- var Action: TCloseAction);
- begin
- if chckboxFormatResult.State = cbChecked then
- CCalcDlg.vbFormatResult := true
- else
- CCalcDlg.vbFormatResult := false;
- CCalcDlg.vlWidth := spnedtWidth.value;
- CCalcDlg.vlNumOfDecs := spnedtNumOfDecs.value;
- end;
-
- end.
-
-