1 |
(* |
2 |
* IBX For Lazarus (Firebird Express) |
3 |
* |
4 |
* The contents of this file are subject to the Initial Developer's |
5 |
* Public License Version 1.0 (the "License"); you may not use this |
6 |
* file except in compliance with the License. You may obtain a copy |
7 |
* of the License here: |
8 |
* |
9 |
* http://www.firebirdsql.org/index.php?op=doc&id=idpl |
10 |
* |
11 |
* Software distributed under the License is distributed on an "AS |
12 |
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
13 |
* implied. See the License for the specific language governing rights |
14 |
* and limitations under the License. |
15 |
* |
16 |
* The Initial Developer of the Original Code is Tony Whyman. |
17 |
* |
18 |
* The Original Code is (C) 2015 Tony Whyman, MWA Software |
19 |
* (http://www.mwasoftware.co.uk). |
20 |
* |
21 |
* All Rights Reserved. |
22 |
* |
23 |
* Contributor(s): ______________________________________. |
24 |
* |
25 |
*) |
26 |
|
27 |
unit NewUserDlgUnit; |
28 |
|
29 |
{$mode objfpc}{$H+} |
30 |
|
31 |
interface |
32 |
|
33 |
uses |
34 |
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, |
35 |
StdCtrls; |
36 |
|
37 |
type |
38 |
|
39 |
{ TNewUserDlg } |
40 |
|
41 |
TNewUserDlg = class(TForm) |
42 |
Bevel1: TBevel; |
43 |
Button1: TButton; |
44 |
Button2: TButton; |
45 |
Edit1: TEdit; |
46 |
Edit2: TEdit; |
47 |
Edit3: TEdit; |
48 |
Label1: TLabel; |
49 |
Label2: TLabel; |
50 |
Label3: TLabel; |
51 |
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); |
52 |
procedure FormShow(Sender: TObject); |
53 |
private |
54 |
|
55 |
public |
56 |
function ShowModal(var UserName, Password: string): TModalResult; |
57 |
end; |
58 |
|
59 |
var |
60 |
NewUserDlg: TNewUserDlg; |
61 |
|
62 |
implementation |
63 |
|
64 |
{$R *.lfm} |
65 |
|
66 |
{ TNewUserDlg } |
67 |
|
68 |
procedure TNewUserDlg.FormShow(Sender: TObject); |
69 |
begin |
70 |
Edit1.SetFocus |
71 |
end; |
72 |
|
73 |
procedure TNewUserDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction); |
74 |
begin |
75 |
if ModalResult = mrOK then |
76 |
begin |
77 |
if Edit1.Text = '' then |
78 |
begin |
79 |
MessageDlg('A User Name must be given',mtError,[mbOK],0); |
80 |
CloseAction := caNone; |
81 |
end |
82 |
else |
83 |
if Edit2.Text <> Edit3.Text then |
84 |
begin |
85 |
MessageDlg('Passwords do not match',mtError,[mbOK],0); |
86 |
CloseAction := caNone; |
87 |
end; |
88 |
end; |
89 |
end; |
90 |
|
91 |
function TNewUserDlg.ShowModal(var UserName, Password: string): TModalResult; |
92 |
begin |
93 |
Edit1.Text := ''; |
94 |
Edit2.Text := ''; |
95 |
Edit3.Text := ''; |
96 |
Result := inherited ShowModal; |
97 |
if Result = mrOK then |
98 |
begin |
99 |
UserName := AnsiUpperCase(Edit1.Text); |
100 |
Password := Edit2.Text; |
101 |
end; |
102 |
end; |
103 |
|
104 |
end. |
105 |
|