1 |
tony |
5 |
unit dblogindlg;
|
2 |
|
|
|
3 |
|
|
{$mode objfpc}{$H+}
|
4 |
|
|
|
5 |
|
|
interface
|
6 |
|
|
|
7 |
|
|
uses
|
8 |
|
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
9 |
|
|
ExtCtrls, StdCtrls;
|
10 |
|
|
|
11 |
|
|
type
|
12 |
|
|
|
13 |
|
|
{ TLoginDlg }
|
14 |
|
|
|
15 |
|
|
TLoginDlg = class(TForm)
|
16 |
|
|
Bevel1: TBevel;
|
17 |
|
|
Button1: TButton;
|
18 |
|
|
Button2: TButton;
|
19 |
|
|
DatabaseName: TLabel;
|
20 |
|
|
Label1: TLabel;
|
21 |
|
|
Label2: TLabel;
|
22 |
|
|
Label3: TLabel;
|
23 |
|
|
Password: TEdit;
|
24 |
|
|
UserName: TEdit;
|
25 |
|
|
private
|
26 |
|
|
{ private declarations }
|
27 |
|
|
public
|
28 |
|
|
{ public declarations }
|
29 |
|
|
end;
|
30 |
|
|
|
31 |
|
|
function LoginDialogEx(const ADatabaseName: string;
|
32 |
|
|
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
|
33 |
|
|
var
|
34 |
|
|
LoginDlg: TLoginDlg;
|
35 |
|
|
|
36 |
|
|
implementation
|
37 |
|
|
|
38 |
|
|
function LoginDialogEx(const ADatabaseName: string;
|
39 |
|
|
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
|
40 |
|
|
begin
|
41 |
|
|
with TLoginDlg.Create(Application) do
|
42 |
|
|
try
|
43 |
|
|
DatabaseName.Caption := ADatabaseName;
|
44 |
|
|
UserName.Text := AUserName;
|
45 |
|
|
Result := False;
|
46 |
|
|
if NameReadOnly then
|
47 |
|
|
UserName.Enabled := False
|
48 |
|
|
else
|
49 |
|
|
if AUserName = '' then ActiveControl := UserName;
|
50 |
|
|
if ShowModal = mrOk then
|
51 |
|
|
begin
|
52 |
|
|
AUserName := UserName.Text;
|
53 |
|
|
APassword := Password.Text;
|
54 |
|
|
Result := True;
|
55 |
|
|
end;
|
56 |
|
|
finally
|
57 |
|
|
Free;
|
58 |
|
|
end;
|
59 |
|
|
end;
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
initialization
|
63 |
|
|
{$I dblogindlg.lrs}
|
64 |
|
|
|
65 |
|
|
end.
|
66 |
|
|
|