-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunit_addengineform.pas
79 lines (60 loc) · 1.66 KB
/
unit_addengineform.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
unit unit_addengineform;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, unit_tfllengine;
type
{ TFormAddEngine }
TFormAddEngine = class(TForm)
ButtonSelectEngine: TButton;
ButtonCancelEngine: TButton;
ButtonSaveEngine: TButton;
EditEnginePath: TEdit;
EditEngineName: TEdit;
Label1: TLabel;
Label2: TLabel;
OpenDialogEngine: TOpenDialog;
procedure ButtonCancelEngineClick(Sender: TObject);
procedure ButtonSaveEngineClick(Sender: TObject);
procedure ButtonSelectEngineClick(Sender: TObject);
private
public
end;
var
FormAddEngine: TFormAddEngine;
implementation
{$R *.lfm}
{ TFormAddEngine }
procedure TFormAddEngine.ButtonSaveEngineClick(Sender: TObject);
begin
{ Make sure we have the required data and then close the form if we do }
if Length(EditEngineName.Text) < 1 then
begin
ShowMessage('An engine name and path are required');
EditEngineName.SelectAll;
EditEngineName.SetFocus;
Exit;
end;
if Length(EditEnginePath.Text) < 1 then
begin
ShowMessage('An engine name and path are required');
Exit;
end;
ModalResult := mrOK;
end;
procedure TFormAddEngine.ButtonSelectEngineClick(Sender: TObject);
begin
{ Open the file chooser so the user can pick an engine }
OpenDialogEngine.FileName := '';
if OpenDialogEngine.Execute then
begin
{ They selected an engine, so set the data appropriately }
EditEnginePath.Text := OpenDialogEngine.FileName;
end;
end;
procedure TFormAddEngine.ButtonCancelEngineClick(Sender: TObject);
begin
{ Close the window without doing anything }
ModalResult := mrCancel;
end;
end.