-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFConfig.pas
86 lines (66 loc) · 1.85 KB
/
FConfig.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
84
85
{
This file is part of the Code::Stats Package
Config form
Copyright (c) 2021 by Maico Smaniotto [email protected]
See the file LICENSE.txt, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
unit FConfig;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls;
type
TFormConfig = class(TForm)
BtOK: TButton;
BtCancel: TButton;
CkEnable: TCheckBox;
GbFields: TGroupBox;
Label1: TLabel;
Label2: TLabel;
EdApiToken: TEdit;
EdApiUrl: TEdit;
CkShowMessages: TCheckBox;
PanelEnable: TPanel;
procedure CkEnableClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BtOKClick(Sender: TObject);
private
public
end;
implementation
{$R *.lfm}
{ TFormConfig }
procedure TFormConfig.CkEnableClick(Sender: TObject);
begin
GbFields.Enabled := CkEnable.Checked;
end;
procedure TFormConfig.FormShow(Sender: TObject);
begin
PanelEnable.Height := CkEnable.Height;
PanelEnable.Width := CkEnable.Width + 4;
CkEnableClick(CkEnable);
end;
procedure TFormConfig.BtOKClick(Sender: TObject);
begin
if CkEnable.Checked then
begin
if EdApiToken.Text = '' then
begin
Application.MessageBox('Error', 'API token must be informed.', {MB_ICONERROR}$10 + {MB_OK}0);
EdApiToken.SetFocus;
Exit;
end;
if EdApiUrl.Text = '' then
begin
Application.MessageBox('Error', 'API URL must be informed.', {MB_ICONERROR}$10 + {MB_OK}0);
EdApiUrl.SetFocus;
Exit;
end;
end;
ModalResult := mrOk;
end;
end.