-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAddScreen.pas
79 lines (66 loc) · 1.43 KB
/
AddScreen.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
unit AddScreen;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdHTTP;
type
TFAddScreen = class(TForm)
BOk: TButton;
BCancel: TButton;
LPort: TLabel;
EPort: TEdit;
EServer: TEdit;
LServer: TLabel;
procedure BOkClick(Sender: TObject);
procedure BCancelClick(Sender: TObject);
procedure EServerChange(Sender: TObject);
procedure EPortChange(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
server : string;
port : integer;
end;
var
FAddScreen: TFAddScreen;
implementation
uses WebServer;
{$R *.dfm}
procedure TFAddScreen.BOkClick(Sender: TObject);
var p : integer;
code : integer;
begin
server:=EServer.Text;
val(EPort.text,port,code);
close;
end;
procedure TFAddScreen.BCancelClick(Sender: TObject);
begin
server:='';
port:=-1;
close;
end;
procedure TFAddScreen.EServerChange(Sender: TObject);
begin
EPortChange(sender);
end;
procedure TFAddScreen.EPortChange(Sender: TObject);
var valid : boolean;
code,p : integer;
begin
valid:=true;
val(EPort.Text,p,code);
if (code<>0) then valid:=false;
if (EPort.Text='') then valid:=false;
if (EServer.Text='') then valid:=false;
BOk.Enabled:=valid;
end;
procedure TFAddScreen.FormActivate(Sender: TObject);
begin
Eserver.text:='http://';
Eport.text:='8080';
port:=-1;
server:='';
end;
end.