-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnewpoly.pas
53 lines (45 loc) · 1.04 KB
/
newpoly.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
unit newpoly;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TfrmNewPoly = class(TForm)
cmdOK: TButton;
cmdCancel: TButton;
Label1: TLabel;
m_strPoints: TEdit;
procedure cmdOKClick(Sender: TObject);
procedure cmdCancelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
m_bOK : boolean;
end;
implementation
{$R *.dfm}
procedure TfrmNewPoly.cmdOKClick(Sender: TObject);
var
n, code : integer;
begin
val(m_strPoints.Text, n, code);
if (code <> 0) then
begin
MessageBox(handle, 'The point count can only be an integer value', 'Error', MB_OK or MB_ICONERROR);
exit;
end;
if (n < 3) or (n > 100) then
begin
MessageBox(Handle, 'The amount of points must be in the range of 3 to 100', 'New polygon', MB_ICONERROR or MB_OK);
exit;
end;
m_bOK := TRUE;
Close;
end;
procedure TfrmNewPoly.cmdCancelClick(Sender: TObject);
begin
m_bOK := FALSE;
Close;
end;
end.