forked from do-/steludio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewAction.pas
61 lines (50 loc) · 1.34 KB
/
NewAction.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
unit NewAction;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TNewActionForm = class(TForm)
Edit: TEdit;
BitBtnOK: TBitBtn;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
procedure EditChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtnOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
NewActionForm: TNewActionForm;
implementation
{$R *.dfm}
procedure TNewActionForm.BitBtn1Click (Sender: TObject);
begin
ModalResult := mrCancel;
end;
procedure TNewActionForm.EditChange (Sender: TObject);
var
i: integer;
f: boolean;
begin
if length (Edit.Text) = 0 then begin
BitBtnOK.Enabled := false;
Exit;
end;
f := true;
for i := 1 to length (Edit.Text) do f := f and (Edit.Text [i] in ['a'..'z', '0'..'9', '_']);
BitBtnOK.Enabled := f;
end;
procedure TNewActionForm.FormShow (Sender: TObject);
begin
BitBtnOK.Enabled := false;
end;
procedure TNewActionForm.BitBtnOKClick (Sender: TObject);
begin
if Application.MessageBox(PChar ('Create new action named ''' + Edit.Text + ''', right?'), 'Confirmation', mb_okcancel) <> idok then exit;
ModalResult := mrOK;
end;
end.