-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.pas
65 lines (54 loc) · 1.45 KB
/
Main.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
unit Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TUnitMain = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
FirstName: TEdit;
LastName: TEdit;
Label4: TLabel;
idNum: TEdit;
Label5: TLabel;
password: TEdit;
Label6: TLabel;
Figure: TSpeedButton;
procedure Label6Click(Sender: TObject);
procedure FigureClick(Sender: TObject);
procedure idNumKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
UnitMain: TUnitMain;
implementation
{$R *.dfm}
procedure TUnitMain.Label6Click(Sender: TObject);
begin
messagebox(0, 'A KirseNET Prodeducation', 'a.H.p.', mb_ok)
end;
function mid(const sData: string; nStart: integer; nLength: integer): string; overload;
begin
Result := copy(sData, nStart, nLength);
end;
procedure TUnitMain.FigureClick(Sender: TObject);
begin
password.text := mid(firstname.Text, 1, 1) + mid(lastname.text, 1, 2) +
mid(idnum.Text, 1, 2) + mid(idnum.Text, 5, 2);
end;
procedure TUnitMain.idNumKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if length(idnum.Text) > 5 Then
begin
messagebox(0, 'An ID Number cannot be longer than 6 digits.', 'ID Length', mb_ok);
idnum.Text := '';
end;
end;
end.