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) 2011 Tony Whyman, MWA Software
|
19 |
* (http://www.mwasoftware.co.uk).
|
20 |
*
|
21 |
* All Rights Reserved.
|
22 |
*
|
23 |
* Contributor(s): ______________________________________.
|
24 |
*
|
25 |
*)
|
26 |
|
27 |
unit dblogindlg;
|
28 |
|
29 |
{$mode objfpc}{$H+}
|
30 |
|
31 |
interface
|
32 |
|
33 |
uses
|
34 |
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
35 |
ExtCtrls, StdCtrls;
|
36 |
|
37 |
type
|
38 |
|
39 |
{ TIBXLoginDlg }
|
40 |
|
41 |
TIBXLoginDlg = class(TForm)
|
42 |
Bevel1: TBevel;
|
43 |
Button1: TButton;
|
44 |
Button2: TButton;
|
45 |
DatabaseName: TLabel;
|
46 |
Label1: TLabel;
|
47 |
Label2: TLabel;
|
48 |
Label3: TLabel;
|
49 |
Password: TEdit;
|
50 |
UserName: TEdit;
|
51 |
private
|
52 |
{ private declarations }
|
53 |
public
|
54 |
{ public declarations }
|
55 |
end;
|
56 |
|
57 |
function LoginDialogEx(const ADatabaseName: string;
|
58 |
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
|
59 |
var
|
60 |
IBXLoginDlg: TIBXLoginDlg;
|
61 |
|
62 |
implementation
|
63 |
|
64 |
{$R *.lfm}
|
65 |
|
66 |
function LoginDialogEx(const ADatabaseName: string;
|
67 |
var AUserName, APassword: string; NameReadOnly: Boolean): Boolean;
|
68 |
begin
|
69 |
with TIBXLoginDlg.Create(Application) do
|
70 |
try
|
71 |
DatabaseName.Caption := ADatabaseName;
|
72 |
UserName.Text := AUserName;
|
73 |
Result := False;
|
74 |
if NameReadOnly then
|
75 |
UserName.Enabled := False
|
76 |
else
|
77 |
if AUserName = '' then ActiveControl := UserName;
|
78 |
if ShowModal = mrOk then
|
79 |
begin
|
80 |
AUserName := UserName.Text;
|
81 |
APassword := Password.Text;
|
82 |
Result := True;
|
83 |
end
|
84 |
finally
|
85 |
Free;
|
86 |
end;
|
87 |
end;
|
88 |
|
89 |
|
90 |
end.
|
91 |
|