-
Notifications
You must be signed in to change notification settings - Fork 3
/
wndConfig.pas
84 lines (65 loc) · 1.96 KB
/
wndConfig.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
unit wndConfig;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, EditBtn,
JSONPropStorage, ScalingBitBtn, AppConfig, Windows;
type
{ TfrmConfig }
TfrmConfig = class(TForm)
edtDoNotPlaceFieldName: TEdit;
edtTemplate: TEdit;
gbBOMExport: TGroupBox;
gbSchematic: TGroupBox;
lblDoNotPlace: TLabel;
lblTemplate: TLabel;
btnSelectFile: TScalingBitBtn;
OpenDialog1: TOpenDialog;
ScalingBitBtn2: TScalingBitBtn;
procedure btnSelectFileClick(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnSelectFileResize(Sender: TObject);
procedure ScalingBitBtn2Click(Sender: TObject);
private
public
end;
var
frmConfig: TfrmConfig;
implementation
{$R *.lfm}
{ TfrmConfig }
procedure TfrmConfig.btnSelectFileResize(Sender: TObject);
begin
btnSelectFile.Width := btnSelectFile.Height;
end;
procedure TfrmConfig.ScalingBitBtn2Click(Sender: TObject);
begin
ModalResult := 1;
if FileExists(edtTemplate.Text) then
begin
AppConfig.PropStorage.WriteString('BOMExport.TemplateFile', edtTemplate.Text);
AppConfig.PropStorage.WriteString('Components.DoNotPlaceFieldName', edtDoNotPlaceFieldName.Text);
ModalResult := 0;
Close;
end else
begin
MessageBoxW(Handle, PWideChar(UTF8Decode('Die ausgewählte Template-Datei existiert nicht.')), PWideChar(UTF8Decode('Fehler')), MB_ICONERROR);
end;
end;
procedure TfrmConfig.FormShow(Sender: TObject);
begin
edtTemplate.Text := PropStorage.ReadString('BOMExport.TemplateFile', edtTemplate.Text);
edtDoNotPlaceFieldName.Text := PropStorage.ReadString('Components.DoNotPlaceFieldName', edtDoNotPlaceFieldName.Text);
AppConfig.RestoreFormState(Self);
end;
procedure TfrmConfig.FormHide(Sender: TObject);
begin
AppConfig.StoreFormState(Self);
end;
procedure TfrmConfig.btnSelectFileClick(Sender: TObject);
begin
if OpenDialog1.Execute then
edtTemplate.Text := OpenDialog1.FileName;
end;
end.